Nagelsmann has agreed a contract until the end of next summer's European championships which will be hosted by Germany.
The 36-year-old was unattached after getting sacked by Bayern Munich back in March.
Germany sacked Hansi Flick as manager after a poor run of form culminated in a 4-1 home defeat to Japan during the recent international break.
Nagelsmann said: "We have a European Championship in our own country. That's something special - something that happens every few decades.
"I subordinate everything to the fact of having a great tournament in a great country. I have a great desire to take on this challenge. We will be a close-knit group next year."
Rudi Voller, the DFB sporting director who took charge of Germany's 2-1 win over France following Flick's dismissal, added: "Nagelsmann was our preferred candidate as national coach when the search began.
"He is not only an absolute football expert but has already proven in all his positions - at a very young age for a head coach - that he can motivate and inspire a team and the entire environment.
"His fire for football is noticeable and contagious. His qualities and his personality will play a crucial role in ensuring that we will all experience a great European Championship in our own country in the summer."
Nagelsmann will start his Germany reign with friendly matches against United States of America and Mexico next month.