Jim Bridenstine, a congressman from Oklahoma, US Navy veteran and former pilot, was confirmed on a 50-49 vote, and will become the 13th administrator of the National Aeronautics and Space Administration seven months after Trump named him to lead the agency.
Bridenstine, 42, has expressed an interest in returning humans back to the moon, spoken of closer ties between NASA and the commercial space industry, and has voiced skepticism about human-caused climate change.
He was a strong supporter of Trump during the 2016 presidential race.
Senate Democrat Bill Nelson, a former astronaut from Florida, was unenthusiastic in his welcome for Bridenstine.
"The @NASA administrator should be a consummate space professional -- not a politician," Nelson tweeted.
NASA's previous full-time administrator, former astronaut Charles Bolden, resigned in January 2017.
The confirmation came as Trump complained in a tweet that Democrats are "'slow walking' all of my nominations."
His pick for Secretary of State, Mike Pompeo, is expected to be voted on next week.