Canada has earned a spot in the quarterfinals of the Olympic men’s volleyball tournament at Rio 2016.

The Canadians clinched their spot in the knockout round with a 3-1 (25-23, 25-17, 16-25, 25-21) upset win over Italy on Monday. The 3-1 victory gave Canada a maximum three points, guaranteeing them a top-four finish in Pool A.

Entering the match, the undefeated Italians, who had already secured top spot in Pool A, had only lost two sets the entire tournament. The second place finishers at last year’s World Cup, Italy entered the Olympic Games ranked fourth in the world.

RELATED: “Monday Mayhem” to decide final Pool A standings

Rio 2016: Gavin Schmitt, volleyball

Canada’s Gavin Schmitt, left, spikes the ball as Italy’s Filippo Lanza, center, and Italy’s Oleg Antonov block during a men’s preliminary volleyball match at the 2016 Summer Olympics in Rio de Janeiro, Brazil, Monday, Aug. 15, 2016. (AP Photo/Matt Rourke)

In a tightly contested opening set, Canada grabbed a 24-22 lead late. After Italy got within one, Osmany Juantorena sent a serve into his own net to give the Canadians the set win, 25-23.

Canada went on a 7-0 run midway through the second set, taking a 14-7 lead as the Italians continued to commit errors. The Canadians continued to cruise through most of the set, taking it 25-17. Italy struggled with its serving and net play, committing 20 errors in the first two sets combined.

Italy turned things around in the third set, taking an early 7-2 lead en route to a 25-16 win. Canada got back on track in the fourth set, taking 12-7 and 15-10 leads. Italy stormed back though, nearly tying the match a couple times. But the Canadians hung on, taking the final three points to win 25-21.

RELATED: Canada picks up crucial win over Mexico

Rio 2016: Steve Marshall, volleyball

Canada’s Steve Marshall celebrates during a men’s preliminary volleyball match against Italy at the 2016 Summer Olympics in Rio de Janeiro, Brazil, Monday, Aug. 15, 2016. (AP Photo/Matt Rourke)

Italy, the Unites States and Canada have secured quarterfinal spots out of Pool A. Monday night’s Brazil-France match will decide who gets the final position.

Gavin Schmitt had a game high 25 points. Graham Vigrass added 14 while Gord Perrin had nine.

Canada, making its first appearance in Olympic men’s volleyball since Barcelona 1992, has had impressive tournament, upsetting the United States and Italy. The team also had a strong showing against Brazil, taking the world’s top-ranked team to four sets.