The 71-26 vote makes the 39-year-old Castro one of the government's highest-ranking Hispanics, a growing group of voters who lean solidly Democratic. His ascension comes two years after he got his first broad national exposure when President Barack Obama picked him to deliver the keynote address at the 2012 Democratic National Convention.
Castro grew up in a working-class San Antonio neighborhood, the Mexican-American son of a single mother who was a Latino rights activist.
He has a law degree from Harvard and is a three-term mayor of Texas' second largest city. His options for rising in Texas politics were viewed as limited in a Republican-dominated Texas, where no Democrat has triumphed in a statewide contest in two decades.
Castro will replace Shaun Donovan as housing secretary. Obama has picked Donovan to become White House budget chief.
Castro's twin brother, Joaquin, is a congressman who represents much of the San Antonio area.
Copyright 2014 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.