This week saw what might be the closest election in Boston's history.

After a three-day recount in the race for Boston City Council's four at-large seats, candidate Julia Mejia won the fourth-place spot over opponent Alejandra St. Guillen — by a single vote.

Mejia will be the first Latina elected to the council; St. Guillen would have been too.

So what did we learn from this nail-biter? Here are five takeaways:

1. The closer the tally, the more brutal the recount.

To understand just how tense this recount was, you kind of had to be there.

For three straight days, a small mob of city officials, campaign volunteers, and elections attorneys had pored over every one of more than 60,000 ballots cast in the at-large race. And on Dec. 9, the cavernous second floor of Boston City Hall fell almost silent as the city's board of elections announced the final tally: Alejandra St. Guillen: 22,491. Julia Mejia: 22,492.

The silence lasted as the news sank in: One vote.

After a pause that seemed to last longer than it did, a single Mejia supporter cheered.

He was immediately silenced, including by Mejia herself. It just wasn't that kind of moment — not yet, anyway.

Hanging in the air was the very real possibility that St. Guillen would challenge the count in court. She didn't; she conceded the next morning, avoiding what would likely have been a messy fight over what we might call takeaway number 2.

2. The closer you peer into an election, the messier it becomes.

There's always surprises when you look at the ballots themselves,” notes Gerry McDonough, a Cambridge elections attorney who represented the St. Guillen campaign in this recount. McDonough has been in the trenches of at least 10 recounts, including the infamous Bush v. Gore presidential election recount in 2000.

Recounts, McDonough says, often end up being less about counting than about how officials decide to interpret ambiguous ballots.

People fill out ballots in fascinating ways,” McDounough said. “Most people do follow directions, but there's people who do things their own way. People change their mind; they make notes when they change their mind on the ballot.”

Michael Goldman, a veteran political consultant who advised Mayor Marty Walsh's 2013 mayoral campaign, says that even though the outcome of an election rarely changes in a recount, the final vote tally always changes, even if just by a handful of votes.

“It always changes. So the final count is never what it is on election night.”

Recounts, to some extent, are a moving target.

3. In elections, sometimes, two's a crowd.

Boston voters got to pick four candidates for the city's four at-large seats. But in the race, it was almost a foregone conclusion that the only seat really up for grabs was the fourth — and as expected, the first three seats went to incumbents.

That put a lot of the city's progressive groups in a bind, because many endorsed both St. Guillen and Mejia, which made for some awkward situations.

The Jamaica Plain Progressives is one such group — it endorsed Mejia, St. Guillen and insurgent candidate David Halbert.

“The recount was one of the most grueling experiences of my life,” said Ann Rousseau, the group's co-chair. “I have never been so tense and focused and bored at the same time.”

Rousseau and her co-chair both volunteered in the recount — but, as it turned out, for opposing campaigns.

“He was on the Julia side and I was on the Alejandra side, but we were all on the side of democracy,” Rousseau said.

Rousseau stands by her group's endorsing both candidates, even if there was ultimately only room for one.

In the 10 years since the JP Progressives was founded, the city council has changed substantially. Ten years ago, the body was almost entirely white and male — Ayanna Pressley, elected to an at-large seat in 2010, was the first woman of color ever to serve on the council. Now — and regardless of whether Mejia or St. Guillen had won — the council will be majority female and majority women of color, with more non-white members than ever before.

“We have to vote with our values," said Rousseau. "It's not just about this race — it's about keeping the city moving forward.”

Which leads to a fourth takeaway from this week's recount election:

4. If you can't win, how you lose matters.

Through the grueling three-day recount, Mejia and St. Guillen were cordial, complimenting each other's campaigns.

After St. Guillen conceded the race, it was her campaign Mejia first singled out for praise when she celebrated the victory, at last, in front of City Hall.

“I want to thank Alejandra St. Guillen for the hard race that she and her campaign team led,” Mejia told reporters.

In an election that will be remembered for a long time, both the winner and loser will have fought a clean fight.

The final takeaway is the most obvious of the historic election:

5. Every vote does count.

That is, as long as it winds up being counted.