James McClean sent the Republic of Ireland into a World Cup playoff as Wales' hopes of qualification were ended by a 1-0 defeat in Cardiff.
Wales lost for only the second time in 22 qualifiers as the absence of star man Gareth Bale came back to haunt them.
The decisive moment came in the 57th minute when Wales skipper Ashley Williams lost possession on the edge of his penalty area and Jeff Hendrick crossed for McClean to slam home his fourth goal of the campaign.
Wales themselves needed a victory to reach next month's playoffs and raise hopes of a first World Cup finals appearance since 1958.
But despite fierce pressure at the start of each half, Ireland held firm and accepted the game's best opening when it came.
Republic manager Martin O'Neill had called for the "Spirit of Lille" beforehand, the French city where his side had beaten Italy at Euro 2016.
O'Neill certainly got that from his central defenders Shane Duffy and Ciaran Clark, who repelled countless Welsh attacks while the Ireland midfield slowly took control of an area where Wales felt the first-half loss of Joe Allen.
Wales had won three successive games to put playoff destiny in their own hands, but this defeat could mark the final game of Chris Coleman's six-year tenure as the manager has said this would be his last campaign.
The first game in Dublin had been a feisty affair which ended in controversy and rancour after Republic captain Seamus Coleman had his leg broken by a Neil Taylor challenge.
That had led to talk of a grudge match on a night when emotions were guaranteed to be running high anyway.
The action was breathless from the start, with Hal Robson-Kanu deflecting Joe Ledley's corner wide and Aaron Ramsey's rising shot from 25 yards tipped over by Darren Randolph in the Republic goal.
The first sense that the contest could turn spicy came when Allen was booked for hacking down David Meyler, ensuring he would be suspended in the event his side reached the playoffs.
Ireland had lost Shane Long on the morning of the match to a hip problem and Daryl Murphy ploughed the loneliest of furrows in the first half.
But danger lurked for Wales at set-pieces, Williams clearing a McClean cross after the Republic had won a free-kick and Hendrick firing over from the resulting corner.
Wales remained on the front foot with Allen's effort deflected wide and Randolph scooping up a tame Lawrence shot, but Duffy dragged wide of the far post after the Republic had reacted quicker to the second ball.
The hosts suffered a blow 10 minutes before the break when Allen was caught in a sandwich of Meyler and McClean and forced to leave the field.
Allen had set Wales' early tempo and his departure was a boost for the Republic, who had shown belated signs of settling and tested Wayne Hennessey for the first time through Robbie Brady.
Wales started the second period as they had the first, with James Chester heading Ramsey's corner into the side netting before even better chances presented themselves.
Randolph tipped over Robson-Kanu's diving header and Ben Davies, unmarked from a corner, could not keep his effort under the crossbar.
The Republic simply knew that they had to score to progress and they did so right in front of their travelling support.
Hendrick took Williams by surprise after Hennessey had thrown the ball to his captain on the edge of the penalty area and when Harry Arter stepped over his centre, Ireland's top World Cup scorer McClean swept home in emphatic fashion.
Wales sent on Liverpool teenager Ben Woodburn to try to rescue the situation just as he had done against Austria last month.
But the Republic defence would not budge and Wales, who had started the evening clinging to hopes that they could win automatic qualification if Serbia had lost, were left with nothing.
Meyler's late booking left him banned for the first leg of the playoff but for the Republic, the World Cup story is not over yet.