Five-time champions Brazil and Cristiano Ronaldo's Portugal joined France in the World Cup knockout rounds with a game to spare on a dramatic day of action in Qatar on Monday.
Portugal's match against Uruguay, which they won 2-0, was briefly interrupted a pitch invader who carried a rainbow flag and wore messages of support for war-torn Ukraine and Iranian women.
Manchester United playmaker Bruno Fernandes starred for Portugal, scoring with a cross-cum-shot early in the second half before converting an injury-time penalty.
Ronaldo wheeled away in celebration after the first goal but FIFA decided he had not touched the ball, denying him a ninth World Cup goal, which would have put him level with Portuguese great Eusebio.
"It was a well-deserved victory," Portugal coach Fernando Santos said. "The first part is over, we are in a hurry. Now I will continue to work to improve what needs to improve."
Portugal top Group H with six points after two matches, three ahead of Ghana, who edged a five-goal thriller against Son Heung-min's South Korea.
Man-of-the-match Mohammed Kudus, 22, one of the hottest properties in world football, caught the eye with two goals including the winner midway through the second half.
The Asian side and Uruguay have a point apiece going into the final round of fixtures in the group on Friday.
- Casemiro strike -
Portugal booked their place in the knockout phase in Qatar hours after Brazil progressed, courtesy of a late goal from Manchester United midfielder Casemiro.
The Manchester United midfielder scored in the 83rd minute of Brazil's Group G match against Switzerland to give his side a 1-0 win at Stadium 974.
The Brazilians, missing the craft of their injured talisman Neymar, looked as though they would have to settle for a point after a Vinicius Junior strike in the second half was disallowed for offside.
But with seven minutes remaining, Casemiro volleyed home with the help of a slight but significant deflection off Manuel Akanji to break the resistance of the obdurate Swiss.
"The first aim was to qualify. That was really important in a group as difficult as ours," the 30-year-old Casemiro told Brazilian broadcaster SporTV.
Tite's Brazil kicked off their campaign in Qatar with a 2-0 victory over Serbia but Paris Saint-Germain forward Neymar limped off with an ankle injury.
Earlier, in the same group, Cameroon dug deep to fight back from 3-1 down against Serbia.
Rigobert Song's team looked almost dead and buried after goals from Strahinja Pavlovic, Sergej Milinkovic-Savic and Aleksandar Mitrovic gave Serbia a two-goal cushion early in the second half.
But substitute Vincent Aboubakar and Eric Maxim Choupo-Moting snatched a draw with two quick-fire strikes just after the hour mark.
Switzerland have three points ahead of their final group game against Serbia, who are level on one point with Cameroon.
Song's side must beat Brazil in their final game to have any chance of progressing.
Gay rights and the use of the rainbow flag have been a simmering issue at the World Cup in Qatar, where homosexuality is illegal.
Monday's pitch invasion in the second half of the Portugal v Uruguay match thrust the topic back into the limelight.
A man carrying a rainbow flag and wearing a T-shirt with the words "Respect for Iranian Woman" on the back and "Save Ukraine" on the front, was on the pitch for about 30 seconds before being tackled and escorted off by security.
The protest was addressed by White House Press Secretary Karine Jean-Pierre, speaking on the eve of a politically charged match between the USA and Iran in Qatar.
"We are concerned over the potential treatment of LGBTQ+ spectators and athletes," she said.
"We urge the state of Qatar and all Qataris to fully realise the emir's message and that is to truly recognise, to welcome everyone to the Cup, the World Cup."
Iran's team has separately been in the spotlight because of anti-government protests at home.
The country has been shaken by more than two months of nationwide demonstrations since the death of 22-year-old Mahsa Amini in morality police custody on September 16.
The Norway-based Iran Human Rights group says more than 410 people have been killed in a government crackdown.