SOCHI, Russia -- Roman Cervenka scored for a second time late in the second period to give the Czech Republic a four-goal lead, and it went on to beat Slovakia 5-3 on Tuesday and advance to an Olympic quarterfinal match against the United States.

"We're one game away to play for a medal and that's pretty special," David Krejci said after scoring the third of the Czechs' first-period goals.

The Slovaks pulled within a goal in the third, but their loss was sealed when Andrej Meszaros was called for slashing with 53 seconds left. They pulled their goaltender to create an even-strength situation and Tomas Plekanec scored an empty-net goal 14 seconds later for the Czechs.

"We got the job done, that's the most important thing," said Krejci, a Boston Bruins forward.

The Czech Republic will play the Americans on Wednesday for a spot in the semifinals.

"It will be a tough game, but at this point in the tournament there's no easy games," said Ales Hemsky, who scored the Czechs' first goal 6:53 after the puck dropped. "So anyone can win against anybody."

Ondrej Pavelec, who stopped 29 shots, didn't give up a goal until Slovakia's Marian Hossa scored with 1:03 left in the second period.

Hossa scored again, off a rebound, midway through the third period. Tomas Surovy's slap shot made the final 11-plus minutes intense in the elimination game until the costly late penalty.

"We came close, but it was too little too late," said Slovakia's Michal Handzus.

The rivals used to be a part one nation until 1993, when Czechoslovakia split into the two countries.

Jaromir Jagr and goaltender Dominik Hasek helped the Czechs win gold in 1998, the first Olympics with NHL players, and bronze in 2006. While Hasek has retired, the 42-year-old Jagr is still skating, shooting and setting up teammates.

The five-time Olympian assisted on Cervenka's first goal midway through the first period, putting the puck on his stick with a centring pass in front of the net.

Jagr has been around long enough that he played for Czechoslovakia at the 1991 Canada Cup -- when he was 19 -- after helping the Pittsburgh Penguins win the first of two straight NHL titles.

Slovakia goaltender Ian Laco, a Kontinental Hockey League backup starting ahead of St. Louis Blues standout Jaroslav Halak, gave up three goals on the first 13 shots he faced and finished with 24 saves.

The Czechs opened the Sochi Games with 4-2 loss to Sweden, beat Latvia by the same score and lost 1-0 to Switzerland in the preliminary round.

The winless Slovaks, who finished fourth and fifth at the last two Olympics, were perhaps the most disappointing hockey team at the Olympics.

Boston Bruins defenceman Zdeno Chara, of the many NHL standouts on the Slovaks' team, said he wished he knew why his team fared so poorly.

"That's the million-dollar question. It's tough to say," Chara said. "We had a rough game the first game against the U.S. That game kind of put us really down mentally, our confidence was not there. But we bounced back against Russia and played our strongest game of this tournament. We thought we would follow up on that game and obviously we didn't.

"It's a big disappointment and we'll have to look back and figure out what went wrong."

Their best showing was Sunday in a shootout loss to Russia, when which Laco made 36 saves to earn a chance to play ahead of Halak. He was pulled from a rout to the Americans and had a goals-against average of more than five in two losses.

Slovakia coach Vladimir Vujtek said he stuck with Laco because of how well he played against the Russians.

"For 65 minutes, he did not miss a single puck," Vujtek said.