Murray, who had won all five previous meetings with the colourful Gulbis, saw his 13-match winning streak ended.

The world number two now heads to Cincinnati for a final chance to tune his hardcourt form ahead of his US Open title defence starting in New York on August 26.

Gulbis went through in less than 90 minutes with three breaks of Murray, twice a champion in Canada.

Gulbis, ranked 38 in the world, reached his third career quarter-final at the Masters 1000 level but first since Madrid in 2010 where he lost to Roger Federer.

"I struggled at the start of the first set from the baseline, but then I got more aggressive and took my opportunities," said Gulbis, who next faces either Juan Martin del Potro or Milos Raonic.

"I started this year at 150 in the world, I was struggling. But slowly and surely I am getting to where I belong.

"I want to crack the top 20. Then, one or two big wins and you are in the top 10."

Fourth seed Nadal, playing his first event in seven weeks since losing in the first round at Wimbledon to Belgian Steve Darcis, needed one and three-quarter hours to see off Polish 15th seed Janowicz, a Wimbledon semi-finalist.

"I had a very good victory today against a very difficult opponent, I'm very happy," said Nadal, winner of seven titles this season.

"I did a few things well and there are a few things I need to improve a little bit more.

"In general I'm pleased with the way I played, it's a great victory for me, an important one."

The victory was a major contrast to Nadal's opening match, where he lost just two games against Canada's Jesse Levine.

Nadal, the French Open champion and with seven titles in 2013, has now won 45 matches since his return in February from a seven-month injury lay-off.

The Spaniard will square off on Friday against Australian qualifier Marinko Matosevic, who needed two and a half hours to defeat Frenchman Benoit Paire, 7-6 (9/7), 6-7 (10/12), 6-3.

The wildly inconsistent Paire produced 16 aces and a dozen double-faults while saving eight of 13 break points.

Nadal's ninth Canadian appearance featured a 68-minute opening set in which the fourth seed saved three set points in the 10th game to level at 5-5.

He dropped serve a game later only to get it back to take the set into a tiebreaker.

In the decider, Nadal recovered from 2-5 down and finally ended the duel on his second chance, a stunning overhead reverse backhand which landed at Janowicz's feet and went through his legs thanks to massive spin.

Nadal's relief was short-lived with the Spaniard going down a break in the second set before finally squaring it at three games apiece.

Nadal, the champion in Canada in 2005 and 2008, squeezed out victory on the first of two match points with his sixth ace.