Joachim Low's side won 5-1 against Azerbaijan to complete the best ever World Cup qualifying campaign by any European side.
They won Group C with 10 wins out of 10 with a goal difference of plus 39, beating Spain's previous record of 10 victories with a plus 23 goal difference from their qualification campaign for the 2010 World Cup.
In Sunday night's victory, Goretzka scored twice, including an clever back-heeled effort, with Sandro Wagner, Antonio Rudiger and Emre Can also finding the back of the net.
The 22-year-old Schalke midfielder told the Bundesliga official website: "I think we were very consistent throughout the qualifiers and we deserved to qualify with a perfect record.
"I was happy with my role in the Confederations Cup, but now I think it's time to play a big role in a big tournament like the World Cup."