"Our boys didn't want to go home yet," Slovakia coach Vladimir Vujtek said.
It is the first time in history Canada has made an early exit from the tournament on three straight occasions. It lost in the quarterfinals in 2010 and 2011.
Milan Bartovic tied it for Slovakia at 13:25, and four minutes later, Handzus gave his country a place in Saturday's semifinals against either Sweden or the Czech Republic.
Information from The Associated Press was used in this report.