MADRID - Felix Auger-Aliassime and Denis Shapovalov won the decisive doubles match as Canada earned its first-ever Junior Davis Cup title with a 2-1 victory over Germany on Sunday.

Shapovalov opened the final with a 6-1, 6-4 triumph over Marvin Moeller to give No. 1 seeded Canada the 1-0 lead in the tie. Auger-Aliassime then lost his first match of the week, dropping a 6-3, 6-3 decision to Nicola Kuhn as Germany evened up the tie at 1-1.

After going 12-0 through its previous four ties, this was the first time Canada had to play a deciding doubles rubber. But Auger-Aliassime and Shapovalov were up to the task against Kuhn and Moeller, defeating the German duo 6-3, 3-6, 6-2 in a tight match.

"It was an unbelievable final," said Auger-Aliassime. "We had to clinch it in the deciding doubles but I think we did a great job. The support on the sidelines was amazing. We are really proud of what we did here."

The third member of the winning team was Benjamin Sigouin and the squad was captained by Oded Jacob. Prior to this year, the best finish by a Canadian Junior Davis Cup or Fed Cup team was second place — 2011, 2004, 2003 (Junior Fed Cup) and 2010 (Junior Davis Cup).

"It's very exciting being the first Canadians to ever win Junior Davis Cup," said Shapovalov. "We knew we had the team to do it as all three of the players on this team are great and contributed. We are very excited."

In Junior Fed Cup action, the Canadian girls and team captain Ralph Platz concluded their week on a winning note after falling in the semifinals. In the third-place play-off, Canada defeated Russia 3-0.

Bianca Andreescu started her team off strongly by posting a 6-2, 6-2 win over Evgeniya Levashova. Charlotte Robillard-Millette then secured Canada the bronze medal with a 6-3, 7-5 victory opposite Olesya Pervushina. In the doubles match, Vanessa Wong and Andreescu teamed to give Canada the sweep, 6-1, 3-6, 6-3 against Elena Rybakina and Levashova.