LENS, France — Turkey rebounded from two losses at the European Championship to beat the Czech Republic 2-0 on Tuesday and keep alive its chances of reaching the knockout stages from Group D.

With their team having failed to score in its defeats to Spain and Croatia, the Turkish fans celebrated with firecrackers and flares that landed on the pitch after the second goal.

Turkey must wait until the final group matches are played on Wednesday to discover whether it can advance as one of the four best third-place teams. Croatia won Group D after beating two-time defending champion Spain 2-1 to finish with seven points.

Spain has six points, Turkey has three and the Czechs are eliminated with one point, 20 years after their team reached the final and 40 years after becoming European champions as Czechoslovakia.

Both teams in Lens on Tuesday needed a win to advance.

Turkey coach Fatih Terim stuck by striker Burak Yilmaz, despite his previously disappointing performances, and the act of faith paid off.

advertisement | advertise on newsday

Yilmaz struck early, rounding off a swift counter attack 10 minutes into the game. Emre Mor broke down the right flank before crossing for Yilmaz, who beat Czech goalkeeper Petr Cech at the near post with a first-time right shot.

As the Czechs were pushing up front, they opened up their defense for the Turkish attack.

Ozan Tufan doubled the lead in the 65th minute, hammering a rising shot past Cech from close range following a free kick by Selcuk Inan.

The 18-year-old Mor looked particularly sharp, smashing a shot wide from inside the area in the first half and cutting in before missing the target on another fast counter in the second.

Volkan Sen’s low drive just missed the target in another good chance of the first half, while captain Arda Turan headed over the bar 15 minutes from the end.

@Newsday

For the Czechs, Tomes Sivok almost equalized six minutes after the opening goal. But set up by Borek Dockal’s cross, his effort hit the post.