A fabulous volley in extra time from Jess Fishlock saw Wales overcome stubborn resistance from Bosnia-Herzegovina in the Welsh capital and reach the World Cup play-off final.
Wales will travel to Zurich to face Switzerland on Tuesday, 11 October as they bid to reach a first major finals.
A record crowd of 15,200 saw Wales have four goals ruled out for offside in an increasingly tense evening.
But Fishlock's superb volley in extra time proved the game's decisive moment.
Wales boss Gemma Grainger did not shy away from the magnitude of the match, saying her side had never played in a bigger game and she made just one alteration from the team that drew with Slovenia last month.
Grainger was boosted by the return of Wales' most capped and important player, Fishlock, who recovered from a hamstring injury fresh from having won the NWSL Shield with OL Reign, the latest trophy in a career laden with them.
Fishlock returned in place of Natasha Harding, who was left out of the squad for "personal reasons" in a decision Grainger admitted was taken by the Football Association of Wales (FAW), with Harding fit to play for her club side Aston Villa.
Wales' joint-top scorer in qualifying, Harding's place in Wales' front three was taken by Ceri Holland, with Fishlock replacing her in midfield. In a close contest, Fishlock's presence ultimately proved the difference.
Fishlock and Holland combined beautifully on five minutes as Wales should have taken the lead, with a freekick routine straight from the training ground culminating in Holland crossing for Fishlock, but her shot from six-yards out was straight at goalkeeper Almina Hodzic.
Hodzic denied Wales again on 10 minutes, when Holland found space inside the penalty area following Kayleigh Green's cross, but her header was straight at the goalkeeper.
Wales also had the ball in the net on 15 minutes, but the video assistant referee was not needed to show that Green was clearly offside as she gathered the ball after Fishlock's tricky run.
However, Wales did also need to rely on goalkeeper Laura O'Sullivan in a frantic opening 20 minutes as she saved expertly with an outstretched leg after Marija Aleksic found herself completely unmarked at a corner. This was as close as the visitors would come to scoring.
The best efforts were coming from the hosts and after Hodzic could only parry Rachel Rowe's long-range effort the goalkeeper did superbly to tip Holland's rebound onto the crossbar.
Holland looked the most likely player to break the deadlock and Hodzic did well to save her low effort after Green's neat flick sent her clear.
Wales' best chance of the first-half came and went on 42 minutes when Angharad James volleyed over after Fishlock's inviting cross, with Bosnia-Herzegovina coach Samira Huren no doubt happy to have reached the interval level.
Bosnia-Herzegovina began the second half far more competitively and threatened when Hayley Ladd's header almost caught out O'Sullivan, but Ladd was able to clear the danger herself.
Wales thought they had their breakthrough on 64 minutes, but an offside flag once again denied Green after Fishlock's through ball.
The tension of the night grew with every minute that passed without a goal, with both sides terrified that one mistake would undo the efforts of 10 qualification games.
Rhiannon Roberts' fine cross on 77 minutes just needed a touch with Fishlock millimetres away, before substitute Ffion Morgan saw an 84th-minute effort ruled out for a contentious offside decision by VAR, with Roberts adjudged to have been interfering with play, despite not touching the ball.
Incredibly, Wales found the net for the fourth time just a minute later, but Fishlock was offside.
Those disallowed goals meant an extra 30 minutes of football, with Holland seeing a shot deflected agonisingly wide two minutes after the restart.
Extra time was essentially attack versus defence with Wales desperate to avoid a penalty shoot-out, especially with goalkeeper Hodzic performing so impressively.
However, Wales' magic moment arrived in stoppage time at the end of the first-half of extra time as Fishlock's fabulous volley from Rowe's pinpoint freekick left Hodzic stranded.
All the visitors' efforts had been on taking the contest to penalties and Wales were able to see out the contest comfortably as their World Cup dream continues.
Marta Huerta de Aza