Nagelsmann, who took over in September 2023, led Germany to the quarter-finals of EURO 2024 on home soil. His initial contract ran until the 2026 World Cup, co-hosted by the United States, Mexico and Canada.
A former Bayern Munich coach, Nagelsmann was the German team's second-youngest coach ever when he took over at the age of 36.
"When I came to the DFB in September 2023, I could not have imagined being a national coach beyond the home Euro," Nagelsmann said in a statement.
"This great feedback that we all receive every day, shows us that our journey together is on the right path. We want to win titles together," he said.