With two second-half goals, South Korea pulled out a 2-1 win over Spain in Ottawa on Wednesday night and advanced to the round of 16 of the Women’s World Cup.

In the 78th minute, defender Soo-yun Kim knocked an apparent cross from the right flank, but the ball soared over Spanish goalie Ainhoa Tirapu and into the net for the decisive goal.

South Korea midfielder So-hyun Cho scored a 53rd-minute goal to tie the game after midfielder Veronica Boquete put Spain on top in the 29th minute.

Spain had a free kick in second-half stoppage time that would have tied the game, but Sonia Bermudez’s attempt from just outside the penalty area crashed off the cross bar to clinch South Korea’s win.

The result moved South Korea into second place in Group E, behind Brazil.

Already assured of first place in Group E before stepping on the pitch Wednesday in Moncton, New Brunswick, Brazil made six changes to its starting lineup and still beat Costa Rica 1-0.

The game was scoreless until the 83rd minute, when Brazil’s Andressa knocked a one-time ball onto the run of fellow midfielder Raquel cutting into the box, and Raquel’s low shot skimmed off the goalie’s hands and inside the far post for the game’s only goal.

The results of Wednesday’s games finalized all of the round-of-16 matchups.

The United States will play Colombia on Monday in Edmonton, Alberta. The winner will earn a quarterfinal date with either China or Cameroon, who meet Saturday in Edmonton.

If the U.S. advances, its quarterfinal opponent could be either Germany or France. The top-ranked Germans meet Sweden on Saturday in Ottawa, while the French play South Korea on Sunday in Montreal.

Brazil, which went 3-0 in group play, stays in Moncton to face Australia in a round-of-16 game Sunday.

The other round-of-16 matchups are Canada against Switzerland on Sunday in Vancouver, British Columbia; Norway against England on Monday in Ottawa; and defending champion Japan against the Netherlands on Tuesday in Vancouver.

The United States’ half of the draw features four of the top five teams in the world rankings — No. 1 Germany, No. 2 USA, No. 3 France and No. 5 Sweden. No. 4 Japan is the leading team in the opposite half of the draw.

Group F

England scored two first-half goals that held up in a 2-1 victory over Colombia, and France routed Mexico 5-0 Wednesday.

Kara Carney scored in the 15th minute and Fara Williams gave England a 2-0 lead in the 38th minute in Montreal. The win secured the Three Lionesses a spot in the knockout round against Norway.

The only goal for Colombia, which already had qualified for the knockout stage, came from Lady Andrade in second-half stoppage time.

France’s frolic in Ottawa started when Marie-Laure Delie scored 34 seconds into the game — the second fastest goal in Women’s World Cup history — followed by Jennifer Ruiz in the ninth minute on an own goal and Eugenie Le Sommer in the 13th and 36th minute to make it 4-0 at halftime.

The final goal came from Amadine Henry with a strike from 25 yards in the 80th minute as France bounced back from a 2-0 loss to Colombia.

With the victory, France clinched first place in Group F over England based on goal differential.

Mexico managed only one shot and possessed the ball for only 34 percent of the game compared with France’s 66 percent. The Mexicans are winless in nine World Cup matches in history.