Theo Hernandez scored the winning penalty after substitute Joao Felix hit the outside of the post with his effort, the only miss.
Players sprinted over to the other end of the pitch to celebrate with fans afterwards, while Portugal, who had overcome Slovenia via a shootout five days ago, were left feeling deflated while they applauded their supporters.
It marks the end of an era for Portugal captain Cristiano Ronaldo, who confirmed this week it would be his final Euros.
Before the match, all eyes had been on a showdown between 39-year-old Ronaldo and France’s Kylian Mbappe but both failed to have an impact, though the Portugal striker did put away his spot-kick.
Mbappe had to be substituted in extra time after an earlier whack to his face, covered with a mask due to a broken nose, so he was unable to take part in the shootout.
It had been a cagey match with relatively few chances though Portugal had the best of them.
Bruno Fernandes and Vitinha were both denied by goalkeeper Mike Maignan before France’s Randal Kolo Muani had a shot deflected inches wide by Ruben Dias.
Moments later, Eduardo Camavinga should have put France ahead when he dragged an effort beyond the far post from close range.
But extra time was needed and when the moment came, Portugal’s talisman Ronaldo stabbed a cutback from Francisco Conceicao way over the bar, to the astonishment of fans behind the goal and their luck ran out after a second shootout in consecutive games.
It means France will now face Spain in the semi-finals in Munich on Tuesday (20:00 BST kick-off).