Confetti still litters the floor of the modest campaign headquarters and the victorious candidate is obviously exhausted, but for Maya Fernández Allende the real hard work is just about to begin.

Allende was just one year old on 11 September 1973 when a rightwing coup d'etat led to the death of her grandfather – Salvador Allende, the then Chilean president. The family fled to Cuba and for three decades the heir to one of Chile's most illustrious and controversial political fortunes was out of the limelight.

All that changed last Sunday, when Fernández Allende won the mayorship of Ñuñoa – a district of the capital, Santiago. But in addition to the pressures of office will come the pressure of assuming the Allende legacy.

"It makes me proud but [is also] a responsibility," she told the Guardian. "My grandfather was a grand man, he was loyal with his people until the end … that is a principle, a value that is not often seen in politics."

A week ago, Fernández Allende's victory was not even discussed as a possibility, as the district had long been held by rightwing politicians. Her opponent Pedro Sabat had been re-elected three times by wide margins and held office for 16 years.

But Chile has undergone a transformation over the past 18 months. Citizen groups fighting hydroelectric dams in Patagonia and demanding free university education have sprouted online and filled the streets with dozens of big marches – gathering up to 150,000 students. The upshot was the narrowest of wins for the challenger — by less than 100 votes out of more than 75,000 cast.

Fernández Allende put her victory down to a longstanding family tradition: hitting the streets. "I walked the entire district twice," she said as a steady stream of giddy volunteers entered and left the one-storey, four-room office.

"When you enter a campaign, you enter to win, not to make a decent stand … I put all my heart into this and it was difficult, versus a mayor who had high voting support, but even before the final announcement I felt it was a victory, nobody had even come close to being that competitive with Sabat. We did this with a team, with a field operation."

Students battled regularly with Sabat by occupying his office and shutting down numerous schools with strikes that lasted for as long as six months. Sabat faced strong condemnation for his assessment that a high school seized by female students had degenerated into "a whorehouse".

Fernández Allende said: "That comment really shook people up. Even people who did not support the [striking] students thought that was too much."

Apart from a whiteboard, the only office decoration was the official photograph of Salvador Allende wearing the Chilean presidential sash and his trademark thick black glasses. "I would have loved to have known him in a more humane way, as a grandfather," said Fernández Allende.

"I don't remember him, I was too small. But I am always entertained by the stories of his life that people tell me. Especially that despite his huge responsibilities, he had a great sense of humour. Always [there] with a wisecrack. That kept him going."

Fernández Allende, who lived in Cuba for nearly 20 years, added: "The political bug bit me late in life." Even upon her return to Chile in 1992, she did little on the political front besides joining the Socialist party. But in 2008, she won her first election as a concejal, or neighbourhood representative, who works closely with the mayor.

She also began to tap into the vein of goodwill still held by her grandfather and was elected to the Socialist party central committee in 2010. But it was the sudden outpouring of anger on the street that really galvanised her career – a sign that her grandfather's legacy of a humane socialist revolution lived on.

"The dictatorship did not allow you to express yourself, you might talk and then be disappeared, so people stopped talking," Fernández Allende said. "For 20 years nobody talked to anybody, you did not know who was a spy. There was lots of silence. People became more introverted. [Now] this generation has changed, it has come back to the street, to knock on the door, to bang the table."