Wales’ penultimate game before the World Cup ended with a 2-1 loss to Belgium in the Nations League in Brussels.
Kevin De Bruyne and Michy Batshuayi rewarded Belgium’s first-half dominance with well-crafted goals, and Wales looked set to suffer defeat.
But Kieffer Moore halved the deficit five minutes after the break, and Robert Page’s side improved a lot in the second half, giving cheer two months before the World Cup in Qatar.
Wales head into their final Nations League game at home to Poland on Sunday with their hopes of survival intact.
Poland’s 2-0 home defeat to the Netherlands means bottom-placed Wales can overtake them with a win in Cardiff and remain in the top flight of European football.
Wales were stopped by injuries with Aaron Ramsey, Ben Davies, Harry Wilson and Joe Allen all missing.
Captain Gareth Bale was among the replacements after his late arrival in the United States on Tuesday.
Bale, who has been slowly building up his fitness in the US ahead of the World Cup, had played for Los Angeles FC in the early hours of Monday morning UK time.
This was the ninth meeting between the two countries in the last decade, with Wales holding up two wins, two defeats and four draws in that period.
De Bruyne had said before the game that he was bored of playing so much in Wales, but the Manchester City midfielder didn’t show it as he put on a masterful performance.
Brennan Johnson scored a late equalizer when the teams met in Cardiff three months ago, and the Nottingham Forest winger formed a three-pronged attack alongside Moore and Daniel James.
Belgium had seven starters in the team that lost to Wales in the quarter-finals of Euro 2016, including De Bruyne, Thibaut Courtois and captain Eden Hazard.
Wales started confidently but fell behind in the 10th minute when Batshuayi’s cross found De Bruyne and he casually passed Wayne Hennessey, who hit the shot.
Youri Tielemans and Hazard were within inches of doubling the lead and De Bruyne, taking advantage of the generous space he was given, fired into a post.
De Bruyne soon scored Belgium’s second goal in the 37th minute, rolling a defender superbly and crossing for Batshuayi to convert the simplest of touches.
There was a brief pause for Wales as Joe Rodon came close and Courtois saved Ethan Ampadu’s header.
But Wales were only spared from falling further behind when Hennessey’s outstretched leg pushed another De Bruyne shot into the post.
Wales returned to the competition with a goal out of nowhere.
Johnson twisted and turned towards the Belgium area with a 40-yard run, and Moore climbed the far post to head his cross in style.
Wales sent in Bale just after the hour mark and he soon swung into action, receiving a cross from James that was deflected.
Belgium received a penalty for a foul on De Bruyne. But replays showed that Joe Morrell had made contact with the ball and the decision was overturned in the VAR review.