MEXICO CITY — The United States government recognized President Juan Orlando Hernández of Honduras as the winner of last month’s disputed election on Friday amid angry protests by Hondurans who believe the vote count was fraudulent.

The decision by the State Department offers support to an ally who has cooperated on issues that concern Washington in Central America — including stemming the flow of illegal drugs and migrants to the Texas border.

Honduras has shown its loyalty elsewhere. It was one of only eight countries to vote with the United States on Thursday against a resolution at the United Nations denouncing President Trump’s recognition of Jerusalem as Israel’s capital.

The State Department said in a statement that “we congratulate” Mr. Hernández, but added that “a significant long-term effort to heal the political divide in the country and enact much-needed electoral reforms should be undertaken.”