It took the five-time world champions just 16 minutes to find the target, with Paris Saint-Germain defender Marquinhos meeting a curling Danilo cross with a powerful header from the edge of the six-yard box.
Ayew scored again in the 83rd minute, and Caleb Ekuban sealed the win with an 87th-minute goal. Enditem
On Saturday Germany will encounter Ukraine in Kiev in the UEFA Nations League while Turkey will clash with Russia in the Nations League on Sunday. Enditem
"We have to give ourselves credit for taking the game seriously," he said. "Despite scoring one or two early goals we continued to give our all and that's what you expect from Brazil's national team."
The Patriots had a chance to sink a buzzer-beater, but guard Henri Wade Chatman failed to hit the target behind the free-throw line at the last second.
"We improved our ball movement with the match going deep. The players had expected to win this match," said Zhejiang coach Gu Jiaqing.
Shanghai guard Peng Szu-Chin hobbled off the court, seemingly through a strain, just one minute into the second half. Without one of its main scorers, Shanghai could not catch up on the offensive end as Xinjiang pulled away through the backcourt combo Wang Siyu and Wang Lili's efforts.
The Cafeteros boss had words of support for Bayer Leverkusen full-back Santiago Arias, who was taken from the pitch on a stretcher after suffering a horrific ankle injury in the first half.
Bolivia couldn't take a trick and Jose Carrasco gifted Brazil their fourth goal by deflecting a Philippe Coutinho cross into his own net.
The next round of the 2020 season sees Formula 1 visit the Portimao circuit for the first time for the Portuguese Grand Prix on October 25. Enditem
Shandong trimmed the deficit to four points midway through the last quarter, but could not get closer afterwards.