The United States finished with bronze, their first medal since 2004 in dressage, which of three equestrian sports in the Olympics is the only one that is judged subjectively. It is also the only discipline that does not involve jumping.
With a total score of 81.936 for all four riders, Germany clinched the top title of the sport they had dominated for decades until they were upset by Britain in 2012.
"This was much more than we expected," said five-time Olympian Isabell Werth. "With younger horses we were hoping if one were weak we could deal... but they were all really good."
Dujardin retains individual dressage title for Great Britain with incredible display
Werth claimed her sixth gold medal and outscored Dujardin with the top mark of 83.711 on Friday. The Briton had 82.983.
Dujardin came out on top in the first Grand Prix test on Thursday with an 85.071 on Valegro, the powerful black horse she trained. The Briton who counts Queen Elizabeth among her fans, won individual and team gold four years ago and has broken numerous dressage score records.
"I'm really, really happy apart from two mistakes. It was just two small misunderstandings," said Dujardin, citing a half pass and a transition into a two-stride manoeuvre as minor problems on her Friday test.
Dujardin has said this will be the last Olympics for Valegro, a horse she calls by the stable name Blueberry.
The US were back in the medals thanks to a high score of 80.644 from Florida-based Laura Graves, who abandoned a career as a hair stylist to train her horse Verdades.
"We knew we had a chance but it was amazing to see it happen," said Steffen Peters, the team's only Olympic veteran.
"You should have seen me in the stands when Laura came down centre line, I cried my eyes out," he added.
Team medals were awarded after three days of sparsely attended Grand Prix and Grand Prix special tests in the Deodoro equestrian centre in western Rio. Individual medals will be presented on Monday after the top 18 riders compete in the choreographed Freestyle competition.
How do horses get to the Olympics? How do they train horses for dressage?
Werth and Weihegold Stride into Last Round of World Cup Dressage Final