In a repeat of the 2016 Olympic Gold-Medal match in Rio, the defending champions raced into a commanding lead despite Matheus Cunha having a penalty saved.
But Richarlison scored on the rebound inside seven minutes. He scored his second and third goals inside the 30 minutes.
Germany fought back after the half time as goals from Nadiem Amiri and Ragnar Ache reduced the gap to 2-3.
But Brazil scored their fourth goal through striker Paulinho to put the game beyond the Germans’ reach.
Meanwhile, midfielder Franck Kessie scored in Ivory Coast’s 2-1 win over Saudi Arabia. In addition, Spain were held to a scoreless draw by Egypt in the opening game.