WASHINGTON — Beto O’Rourke raised more than $6 million online in the first 24 hours after announcing his presidential campaign last week, according to his campaign, outpacing his rivals for the Democratic nomination and making an emphatic statement about his grass-roots financial strength.

Mr. O’Rourke brought in $6,136,736 after declaring his long-anticipated bid with a web video and trip to Iowa on Thursday morning, raising the sum entirely online and from all 50 states, the campaign said.

He narrowly beat the first-day haul of Senator Bernie Sanders of Vermont, who raised $5.9 million after announcing his bid last month and who would go on to raise $10 million before his first week was over.

[Sign up for our politics newsletter and join our conversation about the 2020 presidential race.]

Mr. O’Rourke’s early burst of fund-raising illustrates how much he has captured the imagination of many Democratic activists around the country, who propelled him to break financial records last year in his ultimately losing bid to unseat Senator Ted Cruz of Texas. There were some doubts as to whether those same grass-roots donors would also contribute to him when he was not facing Mr. Cruz — a figure detested on the left — but rather was one more entrant in a sprawling presidential primary.