Seconds after Canadian goalie Ben Scrivens had denied Dick Axelsson with a nice left skate save, Mark Scheifele raced back the other way on left wing. On a 2-on-1 rush, the Winnipeg Jets forward dished the puck in front to Ellis, who tipped it through Swedish netminder Anders Nilsson's legs with 2:22 left.
"Good play by Scheifele," said Ellis. "The patience from Scheifele was unbelievable for such a young guy, he put it right on my tape and I just had to touch it."
In regulation time, Brayden Schenn and Kevin Bieksa also scored for Canada.
Tre Kronor scoring leader Joakim Lindstrom, who left the game with an undisclosed injury in the third period, and Linus Klasen replied for Sweden.
Swedish coach Par Marts said after the game that he hadn't talked to Lindstrom yet and didn't know his status.
"I thought it was an entertaining hockey game," said Canadian coach Dave Tippett. "Both teams made some mistakes that led to chances. Both goalies played very well. We capitalized on a chance in overtime and got the win."
Canada succeeded in getting some revenge too. Last year, the Swedes defeated the Canadians 3-2 in a quarter-final shootout and went on to win gold on home ice – the first team to accomplish that feat since the Soviet Union in Moscow 1986.
This victory could hold the key to Canada's winning its quarter-final matchup for the first time since 2009. Canada is seeking its first gold since 2007.
Scrivens and Nilsson were both solid, as Sweden outshot Canada 32-31.
"I'm happy we won, but we have some things we have to clean up," Scrivens said. "But we did enough to get the job done and get the win."
Sweden completes its round-robin slate against last-place Italy on Monday, while the Canadians will finish up versus Norway on Tuesday. Sweden could still claim top spot in the group if it wins its last game and the Norwegians surprise Canada.
Both teams came into this game with middling power plays, Sweden ranked sixth at 21.74 percent and Canada ninth at 20 percent. While the teams combined for 22 minutes in penalties, 12 going to Sweden, only Bieksa was able to cash in on the man advantage.
"In the NHL playoffs, it's usually two or three power plays a game," Ellis said. "Many times over here, it's more of a special teams battle. Going forward, I think we're going to have to improve both sides of our special teams, and if we can do that I think we'll be in good shape."
After a cautious start, Canada started to go after the Swedes on the forecheck midway through the first period, with Schenn laying his shoulder into Tre Kronor captain Joel Lundqvist a couple of times.
Nilsson had to be sharp during Canada’s second power play, foiling Canadian goal-scoring leader Cody Hodgson twice from quality scoring areas. He also got down to stymie a hustling Nathan MacKinnon from close range.
Sweden drew first blood with 6:11 remaining in the first period. Off a faceoff in the Canadian end, Lindstrom went to the front of the net, got the puck from Oscar Moller, and unleashed a backhander that squeezed past Scrivens. The 2013 World Championship song, “En For Alla for En,” by The Poodles, erupted from the speakers as the Swedish fans rejoiced.
At 16:33, Jonathan Huberdeau got a penalty shot after he burst into the clear on a Schenn stretch pass but was hauled down by Swedish blueliner Niclas Burstrom.
On his attempt, Huberdeau curled into the Swedish zone on the right and, at the last second, tried to replicate the famous Peter Forsberg one-handed move that won the 1994 Olympic final against Canada in Lillehammer. However, Nilsson stretched out his glove and got a piece of it, and the puck dribbled past the post.
The Swedes went up 2-0 at 1:06 of the second period. Gustav Nyquist beat Kyle Turris to the puck on the forecheck and centered it from behind the goal line to Klasen, who beat Scrivens cleanly.
In classic fashion, Canada fought back. Off a faceoff in Sweden’s end, Schenn charged to the crease to bang in a Huberdeau rebound at 3:52 and make it 2-1.
Schenn continued to create havoc around the Swedish net, getting hauled down as he forced Nilsson to make a great right skate save from in close. Canada went to the power play, and Bieksa blew a heavy drive past Nilsson’s blocker to tie the game up again at 7:46.
"We came out strong and played really well, but their comeback from 2-0 down was strong," said Sweden's Mikael Backlund.
The Canadians were carrying the play, but Sweden had some sparkling opportunities during a late second-period interference penalty to MacKinnon.
The scoreless third period was full of missed opportunities.
Canada enjoyed a 5-on-3 power play for 1:09 early in the third period, but the Swedish defenders held their ground around Nilsson.
Axelsson had Sweden's best chance when Canada was penalized for too many men on the ice midway through the period. With a wide-open net, he ended up sliding the puck under Scrivens' body and out the other side.
"We'll get to see who we'll end up facing in the quarter-finals, but there's no denying that we really wanted that extra point," said Lundqvist.
Canadian forward Alex Burrows missed the game due to a charley horse he received on an illegal hit from Joachim Ramoser in Canada’s 6-1 win over Italy. The Italian forward got a one-game suspension.
Belarusian President Alexander Lukashenko attended the game and received cheers when he was introduced to the crowd in the first period. IIHF President René Fasel was also in attendance.