Florian Wirtz had kept their hopes alive with an 89th-minute equaliser before Merino struck in extra time.
Didier Deschamps men have yet to fire in the tournament but must now face a buoyant Portuguese side led by Cristiano Ronaldo
Emma Raducanu claimed her first top-10 win at a major as she calmly ousted ninth seed Maria Sakkari to surge through to the second week of Wimbledon. To borrow a phrase from Jurgen Klopp, this was the performance of a mentality monster.