With the tiebreak in the final set tied 5-5, Dodig -- ranked 41st in the world -- ripped a 135 mph ace past Nadal, then finished the upset by hammering a backhand that the second-ranked Spanish star couldn't handle.
"This is the greatest moment of my life," Dodig said.
After an opening set that lasted only 33 minutes, a different Dodig stepped onto Centre Court at Uniprix Stadium for the second set. He provided a great show to the fans, who had to wait close to two hours to see the start of the match because of a rain delay.
Both players displayed a variety of shots, transforming what looked like an easy affair for Nadal after the opening set into a thrilling match.
Nadal started out with authority and seemed to have an answer for all of Dodig's shots. But Dodig turned the match around largely with his serve. The Croatian finished with 19 aces.
In the third set, Nadal broke Dodig's serve in the eighth game to take a 5-3 lead and had a chance to serve for the match. But Dodig refused to quit and broke back immediately.
In the tiebreak, Dodig gave himself a match point with his 19th ace and put the finishing touch with a spectacular cross-court backhand, right on the line.
"He played very well, very aggressive," Nadal said. "He didn't feel the pressure in the important moments. And at the end of the match, probably I was a little bit unlucky today, no?"
Earlier, Roger Federer defeated Vasek Pospisil of Canada 7-5, 6-3. Pospisil, the second-highest-ranked Canadian behind Milos Raonic, earned eight aces against the world's former No. 1, who was playing his first match since turning 30 on Monday.
The No. 3-ranked Swiss won the Rogers Cup in 2004 and 2006 and was the runner-up in 2007 and 2010.
It was a dream matchup for the 21-year-old Pospisil, who has idolized Federer since childhood. Afterwards, Federer said it's not the first time he's heard of a younger opponent's admiration.
"For me it was important to have role models to look up to, such as (Pete) Sampras and (Stefan) Edberg and so forth," Federer said.
"Then to be able to also play Pete at Wimbledon was very big in my career, it gave me a huge lift to be able to play in a big stadium against a big player -- and I hope it does the same for him."
Play was delayed in Montreal at approximately 6 p.m. due to heavy rainfall.
Earlier in the day, top-seeded Novak Djokovic survived a scare before defeating Russia's Nikolay Davydenko 7-5, 6-1. The 2007 Rogers Cup champion improved his stunning 2011 record to 49-1 overall and 25-0 on hard courts. The Serb's only defeat came at the hands of Federer in the French Open semifinal.
In his first match since climbing to No. 1 in the ATP rankings, the 24-year-old Djokovic battled through a close first set before finishing of the 30th-ranked Davydenko.
Federer, who improved to 40-9 this year, said he was impressed with the 155th-ranked Pospisil's performance.
"He had good variation on his serve," said Federer, who also remarked how surprised he was by the 6-foot-3 Pospisil's height. "It was somewhat tricky getting to know his patterns a bit more."
Pospisil said it felt like a dream when he walked out onto the stadium's biggest stage -- where the crowd roared around him and his idol stood at the other end of the court.
"After that I concentrated on my game and I tried to forget that I was playing against Federer," Pospisil said.
When told Federer was impressed by his level of play, Pospisil blushed, let out a nervous giggle and stumbled on his words a little bit.
"To hear that from Roger, for me it's incredible," the starstruck Pospisil said. "He's been my favorite player for eight years, so it's someone I watched on television every week, so yeah, it's nice to hear that."
Djokovic was happy to finally get back on the court after a four-week layoff, which he partly blamed for falling behind Davydenko 4-1 in the first set. He said switching surfaces from clay to grass to hard court at recent events, and playing an opponent like Davydenko, didn't help either.
"I needed some rhythm, and he didn't give me any," Djokovic said. "I got back into the match. When I needed to use my chance, I did. Then, you know, (the) second set was much more comfortable for me."
He also said it felt good stepping onto a court as the world's top player, particularly in front of the loud, tennis-savvy Montreal crowd. At the same time, he's trying to stay grounded amid all the extra attention that comes with his new status.
"Being No. 1 is a big responsibility, not just on the court but off the court as well," Djokovic said. "(I'm) just trying to handle it in the best possible way, but on the other side trying to keep my life very simple, the way it was before."
Heavy thunderstorms delayed late-afternoon matchups, but once the skies cleared up in the evening, some matches eventually got underway.
In other early singles action, No. 5 Gael Monfils of France defeated American Alex Bogomolov, 6-2, 7-6 (5); No. 7 Tomas Berdych of Czech Republic ousted Alexandr Dolgopolov of Ukraine 4-6, 6-2, 6-3; No. 8 Nicolas Almagro of Spain defeated Ukraine's Sergiy Stakhovsky 6-2, 7-6 (5); No. 10 Richard Gasquet of France beat Thomaz Bellucci of Brazil, 6-1, 6-4; No. 13 Jo-Wilfried Tsonga of France blasted 15 aces to beat Bernard Tomic of Australia, 6-3, 7-6 (1); No. 14 Stanislas Wawrinka of Switzerland knocked out qualifier Michael Russell of the United States, 6-3, 6-2; and Ivo Karlovic of Croatia beat Germany's Philipp Petzschner 6-7 (0), 7-6 (2), 7-6 (6).
Raonic is not taking part in the tournament as he recovers from a hip surgery.