BRASILIA, Brazil — Cristiano Ronaldo finally made his mark at the World Cup — but it came too late to spare Portugal in a 2-1 loss and an early exit from Brazil.

The world player of the year broke his scoring drought at the tournament with an 80th-minute winner against Ghana.

That result left the Portuguese level on four points with United States in Group G but with an inferior goal difference to the second-place Americans, who lost 1-0 to Germany in Recife. Ghana also was eliminated, finishing bottom of the group.

“We knew we had to score three goals and were depending on the result of the Germany game and we couldn’t do that,” Ronaldo said.

Ronaldo barely celebrated after slamming home his goal, giving Portugal its first win after a 4-0 loss to Germany and 2-2 draw with the U.S.

Ghana captain Asamaoh Gyan’s 57th-minute header canceled out an own goal scored by teammate John Boye in the 31st, and at that stage it was the African side that was closer to qualifying.

ALGERIA 1, RUSSIA 1: In Curitiba, Brazil, Algeria qualified for the World Cup knockout stages for the first time, with Islam Slimani’s heading in an equalizer in the 60th minute to give his team enough competition points to reach the second round.

Algeria placed second in Group H behind Belgium with four points, meaning it will meet Germany in the Round of 16.

The victory prompted mass celebrations on the pitch among the players.

Russia, needing a win to advance, went on the attack from the start and dominated the first half with its intricate and swift passing movements through midfield. The Russians took the lead as early as the 6th minute when Alexander Kokorin powerfully headed in a left-foot cross from Dmitry Kombarov.

BELGIUM 1, SOUTH KOREA 0: In Sao Paulo, reduced to 10 men for more than half the match, Belgium still edged South Korea to finish on top of Group H and eliminate the last Asian team from the World Cup.

With a late goal yet again, Belgium made the difference in the 78th minute when defender Jan Vertonghen followed up a shot from teenage striker Divock Origi and tapped in the rebound.

“We knew all games were going to be tough,” said Belgium coach Marc Wilmots. “But even with 10 men, we still pushed forward. These guys are really hungry.”

After three narrow victories and precious little beautiful play, Belgium will now play the United States in Salvador on Tuesday.