President Trump is raising money toward a bid for a second term earlier than any incumbent president in recent history, pulling in tens of millions of dollars in the months after his election and through his inauguration.

Reports filed with the Federal Election Commission on Friday showed that Mr. Trump’s campaign brought in $7.1 million during the first three months of 2017, on top of over $23 million raised with the Republican Party. By contrast, President Barack Obama and the Democratic National Committee brought in a total of about $15 million during the first three months of his first term in 2009.

A vast majority of Mr. Trump’s donors gave small amounts, and relatively little came in large checks from wealthy Republican benefactors. That suggests that Mr. Trump is relying heavily on the grass-roots donors who provided much of the cash — aside from his own fortune — he used for his campaign.

Mr. Trump’s campaign committee spent $6.3 million from January through March, including $1.2 million on merchandise and “Make America Great Again” hats, sales of which helped his fund-raising.