MELROSE — In a surprising turn of events, Republican state Senate candidate Monica Medeiros failed to win her home city in the state election Tuesday.

State Senator Jason Lewis (D-Winchester) defeated Medeiros, an Alderman at-Large, with 48.41 percent (5,714) of the vote compared to Medeiros’ 45.72 percent (5,396). Lewis carried Ward 1, Ward 3 and Ward 5. The Winchester Democrat was also victorious in Ward 2, Precinct 2; Ward 4, Precinct 1 and Ward 6, Precinct 1.

Medeiros prevailed in Ward 2, Precinct 1; Ward 4, Precinct 2; Ward 6, Precinct 2 and both Ward 7 Precincts.

“I want to congratulate Senator Lewis on his win (Tuesday) night,” said Medeiros. “He was certainly a formidable opponent who pushed me to try harder every day. I also want to say how grateful I am for the support I received from the so many volunteers who helped with my campaign, and especially for the support and encouragement I received from my hometown of Melrose.”

Medeiros added, “I know we can feel confident that we gave the voters of the 5th Middlesex District a solid alternative to the status quo.”

Lewis, who won 57 percent to 43 percent across the district, said he was pleased with the election results.

“It was a stronger outcome than we expected,” said Lewis. “It reflected that we made good progress.”

Lewis was referring to the special election held in April when he first ran against Medeiros.

“We worked hard to visit every neighborhood in the district,” he said. “And we worked hard on meeting the needs in the district. Voters were pleased with the progress we made.”

Lewis said he will now concentrate on building upon what he started over the next two years.

“I want also to congratulate Monica Medeiros for her efforts,” Lewis added. “She and her supporters worked hard, as well. I look forward to working with her.”

Brodeur defeats Lock

State Representative Paul Brodeur (D-Melrose) defeated Greenwood Republican John Lock with 65.85 percent of the vote (7,772) compared to Lock’s 27.68 percent (3,267). Brodeur won each ward decisively.

“I feel good today,” said Brodeur. “It was a really great show of support across the district.”

Brodeur represents all of Melrose, Wakefield Precincts 4, 5 and 6 and a sliver of Malden on Beacon Hill.

“I appreciate the support and will continue to work with all three communities to make them even better. It’s been very humbling, and I am truly grateful for everyone’s support,” Brodeur said.

In an email, Lock commented, “While unsuccessful in my bid to bring balance to Beacon Hill, I am happy to have given the voters a choice on the ballot this year and I respect the choice they made in a tremendous turnout. I congratulate Paul Brodeur in his victory and I wish him all the best in his third term.”

State races

In the race for governor, Democrat Martha Coakley pulled out a narrow victory over Governor-elect Charlie Baker in the city, as 48.31 percent of voters favored Coakley (5,702) over Baker’s 46.61 percent (5,501).

As the Weekly News went to press Wednesday morning, Baker held a 48.5 percent lead over Coakley’s 46.6 percent statewide with 99 percent of precincts reporting. Coakley conceded the race on Wednesday morning.

Independent Party candidate for governor Evan Falchuk garnered 3.24 percent with 382 votes. Independents Scott Lively and Jeff McCormick received 52 and 42 votes respectively, and both candidates polled less than one-half percent.

Democrat Edward J. Markey of Malden was easily returned to the U.S. Senate. Melrose voters backed Markey over his Republican opponent Brian J. Herr of Hopkinton, 7,602 votes to 3,756.

Prospect Street resident Katherine Clark will be heading back to Washington to represent the Fifth Congressional District. Clark received 8,473 votes. There were 3,073 blanks and 257 write-ins cast as well.

The state has a new Attorney General, Democrat Maura Healey of Boston. Melrose favored Healey over Winchester Republican John Miller, 7,092 to 4,089.

Democrat William Galvin retained his seat as Secretary of State and carried Melrose by a wide margin. Galvin defeated his Republican challenger David D’Arcangelo 7,675 to 3,213. Green–Rainbow party candidate Daniel L. Factor got 344 votes locally.

In the three-way race for Treasurer, Melrose voters favored Democrat Deborah Goldberg, who was elected state Treasurer, with 6,101 votes over Republican Michael Heffernan’s 4,259. Green–Rainbow candidate Ian T. Jackson received 484 votes.

Incumbent Democrat Auditor Suzanne Bump retained her seat statewide and cruised to an easy victory in the city over Republican Patricia Saint Aubin. Bump received 6,338 votes compared to Saint Aubin’s 3,839. Green-Rainbow candidate MK Merelice got 442 votes.

For Governor’s Council, incumbent Democratic Councillor Terrence W. Kennedy of Lynnfield retained his seat statewide by a margin of 72 percent to 28 percent over Republican Vincent Lawrence Dixon. In Melrose, Kennedy won 55.56 percent to 31.14 percent. Kennedy received 6,658 votes compared to Dixon’s 3,676.

Marian Ryan was elected District Attorney. Ryan, who did not have a Republican opponent, received 7,726 votes in the city. There were 3,908 blanks and 169 blanks.

In the Register of Probate race, Melrose voters favored Democrat Tara Decristofaro over Republican John Lambert, 6,644 votes to 3,515.

Ballot questions

The city voted in line with the statewide electorate on all four ballot questions.

• Question 1, the repeal of gas tax indexing, passed statewide 52.9 percent to 47.1 percent. Melrose voters favored the repeal 5,899 to 5,515.

• Question 2, the expansion of the bottle bill, failed overwhelmingly statewide, 73 percent to 26 percent. Local voters supported that sentiment, with 8,396 votes cast against expansion and 3,196 votes cast in favor of it.

• Question 3, which sought to ban casinos in the state, failed statewide by a 60% to 40% margin. The city’s voters favored keeping the law that will bring casinos to Everett and Springfield and a third location, and a slots parlor to Plainville, with 6,409 votes cast in favor and 5,146 against.

• Question 4 passed statewide by a similar 60-40 spread. Its passage will enable certain employees to earn either paid or unpaid sick leave, based on the size of their employer. Melrose voters overwhelmingly approved Question 4, 7,053 to 4,411.