"I am a candidate for president of the United States," the 44-year-old Castro told a crowd in San Antonio's historic Guadalupe Plaza, during a speech that frequently invoked the immigrant heritage that brought his family to the US from Mexico.
Often called a rising star in the Democratic Party, Castro, who was Obama's housing secretary -- and the youngest member of that cabinet -- is expected to be part of a diverse field of candidates eager to challenge President Donald Trump.
At a time when the federal government has been partly shut down over Trump's demand for funds to build a wall on the Mexican border, Castro sounded a contrasting message.
He said San Antonio, a city that is nearly two thirds Hispanic, "represents America's future: diverse, fast-growing, optimistic."
"Yes, we must have border security, but there is a smart and humane way to do it. And there is no way in hell that caging children is keeping us safe," Castro said.
"We say no to building a wall and say yes to building community," he added, to roars from the crowd.
Trump wants the border wall to block illegal immigrants he has sought to equate with crime, drugs and gangs.
"There is a crisis today -- it's a crisis of leadership. Donald Trump has failed to uphold the values of our great nation," Castro said.
Urging his supporters to look around the blue-collar neighborhood where he grew up, Castro said, "there are no frontrunners that are born here, but... with big dreams and hard work, anything is possible in this country."
- A brother in Congress -
He added that his grandmother Victoria would surely have been amazed when she arrived from Mexico in 1922 -- she went on to work as a maid and a cook -- had she known that one grandchild would end up in Congress and the other as a presidential candidate.
Castro's twin brother Joaquin, who introduced him Saturday, is a congressman. The two rode to the event together on the same bus line that once took them to public school.
Julian Castro's strong oratorical skills, experience in the Obama cabinet and as mayor of the nation's seventh largest city, coupled with his charisma, could help propel him into the top tier of Democratic candidates.
Castro's national profile rose sharply in 2012 when he became the first Latino to deliver a keynote speech at the Democratic national nominating convention.
A Latino candidate would be expected to generate enthusiasm among the country's large and growing population of Hispanic voters, around two thirds of which supported Hillary Clinton in 2016.
But he would start out as one of the underdogs in a political showdown that may well feature heavyweights like former vice president Joe Biden, US senators Elizabeth Warren, Bernie Sanders and Kamala Harris, and perhaps even billionaire businessman Michael Bloomberg.
Another Democrat, 37-year-old Congresswoman Tulsi Gabbard of Hawaii -- a lifelong surfer -- announced Friday that she too will seek the party's presidential nomination.
Castro is the third candidate with a Latino background to seek the presidency in recent years, after two Republicans -- Senator Ted Cruz of Texas and Marco Rubio of Florida -- unsuccessfully faced Trump in that party's 2016 primary campaign.