HOUSTON — Representative Beto O’Rourke, the Texas Democrat whose unsuccessful underdog Senate bid this year turned him into a political celebrity and fund-raising powerhouse, told an El Paso audience on Monday that he was not ruling out running for president in 2020.

Mr. O’Rourke had previously said, on repeated occasions, that he would not seek the presidency in the next election. But Mr. O’Rourke has demonstrated strong appeal with a cross-section of Democrats as well as with people who had never voted before or infrequently cast ballots, and he now possesses a list of hundreds of thousands of small donors that is the envy of most politicians mulling a White House bid.

A three-term liberal congressman from El Paso, Mr. O’Rourke, 46, lost to Senator Ted Cruz in a hard-fought campaign to become the first Democrat to win a Senate race in Texas since Lloyd Bentsen was re-elected in 1988. But Mr. Cruz won by just 2.6 percentage points in a solid-red state — President Trump carried Texas by nine points in 2016 — and Democrats have spent weeks speculating about Mr. O’Rourke’s future in politics.

At a town hall event on Monday and in remarks to reporters afterward, Mr. O’Rourke suggested he was now open to a presidential run, a significant shift from his remarks on the matter during his Senate race.