ROME — Prime Minister Giuseppe Conte of Italy and his coalition government of unlikely allies surmounted their first hurdle on Monday, easily winning the confidence of lawmakers in Parliament.

The coalition, formed of the anti-establishment Five Star Movement and the center-left Democratic Party, as well as a small left-wing party, won with 343 votes in Mr. Conte’s favor, 263 votes against and three abstentions, after a long day of debate among lawmakers in the lower house. He is expected to face a similar vote in the Senate, where he has a slimmer majority, on Tuesday morning.

Hundreds of protesters, in a rally organized by the right-wing parties Brothers of Italy and the League, gathered outside Parliament on Monday over what they consider a government with no democratic legitimacy. The League, an anti-immigrant party, had governed with Mr. Conte until a month ago, when its leader, Matteo Salvini, pulled his support in hopes of forcing an election. His strategy backfired when Mr. Conte managed to form the new coalition.

Mr. Conte, in an hourlong speech urging fellow lawmakers to back his coalition, vowed to distance the government from the firebrand rhetoric that has been characteristic of Mr. Salvini, though he avoided mentioning the League leader directly.