In the 1916 United States presidential election, President Woodrow Wilson defeated Charles Evans Hughes, the Republican candidate.
Wilson ran on the slogan 'He kept us out of war'. From what I have been able to find, this did assist his popularity some. (Hughes accused him of failing to make adequate preparations for war, which cemented his image as the antiwar candidate.) Most of his popularity (or, in certain quarters, unpopularity) revolved around questions of domestic reform, but being antiwar surely helped.
But the election result was astonishingly close. According to Wikipedia,
The key state proved to be California, which Wilson won by only 3,800 votes out of nearly a million cast. Although New Hampshire may not have been a deciding state in the election, the margin of victory for Wilson there was the second smallest ever recorded in an American presidential election at just 56 votes, behind Franklin Pierce's 25 vote victory in Delaware in 1852.[a] If Hughes had carried California and its thirteen electoral votes, he would have won the election.
On the face of it, that means the slogan was indeed needed; without it, Wilson wouldn't have had enough popularity to make the numbers by such a tiny margin.
However, it has been argued that things are not as they seem; that the Californians who were antiwar, primarily labor, were Wilson supporters anyway, and would have voted for him regardless of that slogan; that it made no difference in the end. And there does seem to be some evidence that labor was the group most strongly opposed to joining the war, e.g. Preparedness Day Bombing
Isolationism remained strong in San Francisco, not only among radicals such as the Industrial Workers of the World ("the Wobblies"), but also among mainstream labor leaders. At the same time, with the rise of Bolshevism and labor unrest, San Francisco's business community was nervous. The Chamber of Commerce organized a Law and Order Committee, despite the diminishing influence and political clout of local labor organizations. The Preparedness Day Parade was organized by the Chamber of Commerce and the anti-union conservative business establishment.
Was there strong antiwar sentiment among other sections of California society?
Were there any states other than California and New Hampshire in which the result was close enough that prevailing antiwar sentiment might have made the difference?