The Czechs had inserted goalie Martin Pinc at the end of regulation and the game ended soon after. Canadian defenceman Eric Brewer took a point shot and Staal shovelled in the rebound for his second of the night.
Jay McClement and captain Shane Doan also scored for Canada, which has won all five of its games at the tournament and will play its final qualifying round game against the U.S. on Monday night.
Rostislav Olesz, Marek Zdlicky and Tomas Plekanec had power-play goals for the Czech Republic, which earned one point for the loss and barely squeaked into the quarter-final. The Czech players were even smiling after Staal had scored the winner.
Canada has now only beaten the Czechs three times in the last 12 times they've met at this event.
It was the toughest game Canada has faced in this year's tournament as it trailed three times.
Staal made it 2-2 early in the third period after Canada had killed off a penalty to Doan. Mike Cammalleri found Staal with a nice cross-ice pass and the Carolina Hurricanes forward beat Roman Cechmanek with a backhand deke. The Czech goalie was angry because he had taken a shot off the mask shortly before the goal was scored and the play hadn't been whistled dead - as it's supposed to be in international hockey.
Olesz made it 3-2 at 6:39 on the power play by knocking the puck past Dwayne Roloson after the Canadian goalie had stopped a shot from the point.
But Doan tied it just over five minutes later when he beat Cechmanek through the legs with a quick shot after centre Matthew Lombardi had won a faceoff to him.
The game started in familiar fashion for Canada, which allowed the first goal for the fifth straight time. Zdlicky wired a slapshot from the point that eluded two Canadian penalty killers and a screened Roloson at 13:17 of the first period.
It was the only puck that would beat the Canadian goalie during an excellent opening 20 minutes. Roloson looked sharp and stopped 17 shots in the period.
Canada got a break to draw even. With fans whistling in the seats at Mytischi Arena, Cechmanek and a few others appeared to think the play had been stopped. McClement wasn't one of them and wisely spun in the slot and fired the puck past the confused Czech goalie at 2:15 of the second period.
The public address announcer then twice warned fans not to whistle.
Canada was generating more offence in the middle period, but the Czechs moved ahead 2-1 with another power-play goal. Roloson made a nice stop on captain David Vyborny at one side of the goal, but couldn't get across the net quick enough to stop Plekanec a moment later. It was the fourth goal of the tournament for the Montreal Canadiens centre.
The Czechs thought they had made it 3-1 with 20 seconds to play in the middle period when Olesz tried to stuff in a wraparound. He celebrated at the bench with teammates while referee Vyacheslav Bulanov reviewed the play. After a few minutes, it was ruled that the puck didn't cross the goal-line.
Notes: Canadian defenceman Shea Weber returned from his three-game suspension for hitting a German player with an elbow to the head . . . The Czech Republic has won five world championships since 1996; Canada has won three times over that period . . . Canada is 4-11 all-time versus the Czech Republic at the world championship.