Slovakia's David Soltes beat Canada goalie Spencer Martin of the Mississauga Steelheads to open the scoring at 3:11 of the first period. Nicholas Baptiste of the Sudbury Wolves tied it at 7:20 before McDavid's power-play goal at 16:39 put Canada in front to stay.
Captain Sam Reinhart of the Kootenay Ice scored midway through the third period and was named player of the game for the Canadian side.
"We came out the way we wanted to," Reinhart said. "We were able to play with four lines throughout the whole game and really work it down low for the majority of the game."
Samuel Bennett-McDowell added an insurance goal for the Canadians, who outshot Slovakia 35-13.
In other games, Russia edged the United States 4-3, Sweden crushed Germany 9-1 and Finland shut out Latvia 7-0.
Canada next plays Germany on Saturday.
The tournament is being played on two 2014 Olympic rinks. Canada will play the first round in Group B against Slovakia, Germany, Switzerland and Sweden at the 7,000-seat Shayba Arena.
The United States is looking for a fifth straight gold medal at the event. The Americans and host Russia are in Group A with Latvia, Finland and the Czech Republic at the 12,000-seat Bolshoy Ice Dome.
Many top players are unavailable to participate at the tournament because they're still involved in playoffs with their junior clubs.
The semifinals are on April 26 with the final on April 28.
Canada won gold in 2003 and 2008 but then was out of the medals until it took bronze at last year's event.