The Slovaks pulled within a goal in the third period, but their setback 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.
That ensured the Czechs, who opened the Sochi Olympics tournament with 4-2 loss to Sweden, beat Latvia by the same score and lost 1-0 to Switzerland in the preliminary round, will take on the U.S. team on Wednesday for a spot in the semifinals.
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 final period. Tomas Surovy's slap shot made the final 11-plus minutes intense in the elimination game until their costly penalty
The rivals used to be a part one nation until 1993 when Czechoslovakia split into two countries, the Czech Republic and Slovakia.
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 tape with a centering 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.
Ales Hemsky had a goal 6:53 into the game, Cervenka scored 29 seconds later and David Krejci gave them ahead 3-0 lead late in the first period.
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 winless Slovaks, who finished fourth and fifth at the last two Olympics, were perhaps the most disappointing team in the 12-team tournament.
Their best showing was Sunday against Russia in a shootout setback in which Laco made 36 saves to earn a chance to play ahead of Halak, who was pulled from a rout against the Americans and his goals-against average of more than five in two losses.
Slovakia closed the game strong after a shaky start.
Even when it looked like the Slovaks might make a play, Boston Bruins star defenseman Zdeno Chara led Hossa too much on a pass up the ice and the Chicago Blackhawks forward ended up getting called for hooking while he tried to get the puck back early in the second period.
Chara was called for tripping a few minutes later when he used his stick to play defense instead of moving his skates to get in a better position.