After Mayor Elizabeth Tisdahl announced her decision not to run for a third term, Hagerty announced his candidacy for mayor on October 18, 2016, becoming the third candidate out of an eventual five. His status on the ballot was briefly threatened by an ethics objection from fellow candidate Jeff Smith, who cited a 1992 city referendum changing the ballot procedure for multiple candidates, but the Evanston Board of Ethics dismissed the complaint. Hagerty's campaign quickly emerged ahead in fundraising; by January 2017, it had raised over $100,000, about half of which came from Hagerty himself. By March, Hagerty's campaign had raised more than all four other candidates combined. Hagerty was endorsed by three preceding mayors of Evanston: Tisdahl, Lorraine Morton, and Jay Lytle. Hagerty received 44.4% in the February 28, 2017 mayoral primary, advancing him to a runoff election facing sixth ward Alderman Mark Tendam, who won 20.5%. Despite Hagerty's lead in the primary, the runoff election on April 4, 2017 was surprisingly close, with less than a one percent margin separating Hagerty and Tendam. Tendam conceded the race six days later. The final election results showed Hagerty winning by just 115 votes.
Administration
Hagerty was sworn into office on May 8, 2017. Members of the Evanston City Council's Rules Committee had raised concerns about a possible conflict of interest before Hagerty was sworn in, since First Bank and Trust, on whose Board of Directors Hagerty sat, was the city's financial institution, but Hagerty stepped down from the Board before taking office. Hagerty's immediate agenda as mayor upon assuming office included pursuing physical improvements to city facilities and working with the Cradle to Career education consortium. In June, following President Donald Trump's announcement of withdrawal from the Paris climate agreement, Hagerty reiterated the City's commitment to climate action, reaffirming his support of the Compact of Mayors and the Climate Mayors coalition. Following an October 2016 Cook County Board measure to gradually increase the county minimum wage to $13, many suburban municipalities passed measures overriding the wage hike just days before the first incremental increase to $10 on Saturday, July 1, 2017. Hagerty called an emergency meeting of the Evanston City Council on Friday, June 30 in order to give Evanston an opportunity to temporarily do the same. The announcement was met with criticism from local leaders, including City Clerk Devon Reid, who stated that a minimum wage increase was not a "bona fide emergency" and therefore did not qualify for an impromptu emergency meeting under the Illinois Open Meetings Act. Further, Hagerty was attacked for calling the minimum wage increase "a fiscal danger to Evanston's businesses and the City of Evanston's future tax revenues," even though he supported such an increase during his campaign. At the emergency meeting, Hagerty and members of the Council announced that a vote on the override measure would not take place, expressing support for the wage increase. Two months later, the Illinois Attorney General's office determined that the meeting had indeed violated the Open Meetings Act, although no remedial action was taken.