Germany had 22 shots to Canada's six and enjoyed 67% possession, but somehow managed to lose to the tournament's surprise package. Nevertheless, Germany go through to the quarter-finals and will play Sweden or China.
Two-time world champions Germany sneaked into the women's football quarterfinals at Rio 2016 despite Melissa Tancredi's double maintaining Canada's perfect record in Brazil with a 2-1 win in Brasilia.
The German women's team have never done better than three consecutive bronze medals won between 2000 and 2008 and will do well to make it back to the podium after taking just four points from their three Group F games.
Canada topped the pool as Tancredi cancelled out Melanie Behringer's early penalty before striking the winner on the hour mark for the 2012 bronze medallists.
Sweden or China lie in wait for Germany, who could face Canada again in the semi-finals if the Canadians see off France or New Zealand in Friday's quarterfinals.
Germany edged out Australia for second place by just one goal on goal difference after the Matildas smashed Zimbabwe 6-1. However, the Africans' spirits weren't crushed on their first ever tournament appearance as they jubilantly celebrated Emmaculate Msipa's injury-time consolation.
Australia progress to the last eight as one of the two best third-placed sides.
The USA's all-conquering women continue their quest for a fourth straight gold against Colombia later in the Amazonian city of Manaus, nearly 3,000km from Rio.
The world champions have already secured their place in the quarter-finals with victories over France and New Zealand.
Hosts Brazil, who have put their struggling male counterparts to shame with thrilling wins over China and Sweden, hope to continue their momentum with five-time World Player of the Year Marta to the fore also in Manaus later against South Africa.