Goetze, who scored the winner in the 2014 World Cup final, netted Germany's second goal against Italy at Bayern's Allianz Arena in Munich after Toni Kroos had put the hosts ahead yesterday.
Defender Jonas Hector and Arsenal midfielder Mesut Ozil netted in the second-half before replacement Stephan El Shaarawy scored Italy's late consolation goal.
"All-in-all, we put in a smart performance, defended well and did well in attack," said visibly relieved Germany coach Joachim Loew.
"Today we saw what happens when when we go out on the pitch with the right mentality," pointed out defender Mats Hummels.
More From This Section
Goetze put himself in the shop window with a goal-scoring performance in his 50th international.
With a year left on his Bayern contract, Goetze is weighing up his options after just four starts this season under Pep Guardiola.
For next season, he has been linked to Liverpool, to work again with Jurgen Klopp, or a return to Borussia Dortmund, who Bayern paid 37 million euros ($41.8m) for him in 2013.
"For me it's just important to play again. I've missed it and it was great that the coach trusted in me.
"It was a great feeling to be on the pitch again."
This was Germany's first win over Italy in the ninth meeting since their 2-0 victory in a 1995 friendly.
The win was a welcome tonic for Loew, who made five
changes from the team which threw away a two-goal lead against England.
Thomas Mueller set up Germany's first two goals and skippered his country for the first time on his 70th appearance.
Their captain and goalkeeper Gianluigi Buffon won his 156th cap.
But the 38-year-old leaked four goals in Munich, just as he did for Juventus in their 4-2 defeat, and Champions League last 16 exit to Bayern, a fortnight ago.
Kroos gave Germany the lead when he fired Mueller's cross past Buffon on 24 minutes.
Germany doubled their tally on 44 minutes when Mueller chipped to Goetze, who shook off two defenders to head home.
Hector scored the third when Julian Draxler broke free of Bonacci, who dropped to the turf, on 59 minutes.
Buffon was lucky to stay on when he brought down Germany wing-back Sebastian Rudy in the area on 74 minutes.
Austrian referee Oliver Drachta kept his cards in his pocket and Ozil fired home the resulting penalty.
El Shaarawy beat Germany goalkeeper Marc-Andre ter Stegen, in for the ill Manuel Neuer, from outside the box on 83 minutes for Italy's consolation.
Germany have pre-Euro 2016 warm-up games against Slovakia and Hungary in the fortnight before their opening Group C game against Ukraine on June 12.