Former New Mexico Gov. Gary Johnson on Sunday won the Libertarian Party’s presidential nomination, getting more than 50 percent of the vote in a field of five.

Johnson, who was heavily favored to win the nomination, won with 55.8 percent of the vote, followed by Austin Peterson, of Missouri, with 23 percent; John McAffee, of Tennessee, with 14 percent; and Darryl Perry, of New Hampshire, with 5.6 percent.

“I’ve always said, it’s your hard work,” Johnson, the 2012 Libertarian nominee, told party members in his acceptance speech. “Your work has gotten us to this point. I will work as hard as I can to represent all you in this room.”

Former Massachusetts GOP Gov. William Weld was selected as the party's vice president.

Weld was Johnson's top pick, but his preferred ticket appeared in peril starting late last week.

Some party activists were purportedly upset when Johnson on Thursday tried to portray Weld as “the original libertarian,” considering Weld joined the party just weeks ago.

Weld lost on the first round of balloting but won on the second -- getting 50.6 percent of the vote, barely over the 50 percent threshold.

Weld made clear Sunday to the party faithful that he’s been a Libertarian vice presidential nominee for just 14 days, which he described as a “learning experience.”

“I think every day I become better a Libertarian,” he said. “I remain open to suggestions.”

Though the Libertarian candidate is always a long shot to become U.S. president, Johnson in recent polls has double-digit popularity among voters, in a three-way matchup with presumptive GOP presidential nominee Donald Trump and Democratic front-runner Hillary Clinton, who each have historically low popularity.

Fox News’ Lauren Blanchard contributed to this report.