Mirzakhani had been battling breast cancer for the last four years and it had spread to her bones, according to media reports.
News of her passing drew messages of sorrow and sympathy from around the world.
Iranian Foreign Minister Mohammad Javad Zarif extended a message of condolence.
“The news of young Iranian genius and math professor Maryam Mirzakhani’s passing has brought a deep pang of sorrow to me and all Iranians who are proud of their eminent and distinguished scientists,” Zarif posted in Persian on his Instagram account, according to Tehran Times.
“I do offer my heartfelt condolences upon the passing of this lady scientist to all Iranians worldwide, her grieving family and the scientific community,” he added.
Born and raised in Tehran, Mirzakhani initially wanted to become a writer. Yet her incredible gift at solving mathematical problems became apparent in high school, and mathematics became her calling.
“It is fun – it’s like solving a puzzle or connecting the dots in a detective case,” she once said. “I felt that this was something I could do, and I wanted to pursue this path.”
She achieved international fame as a teenager, when she won gold medals at both the 1994 and the 1995 International Mathematical Olympiad.
Mirzakhani got a bachelor’s degree from the Sharif University of Technology in 1999, then did her doctoral studies at Harvard University, where she was supervised by another Fields Medal winner, Curtis McMullen. She completed her Harvard Ph.D. in 2004, and became a professor at Stanford.