Maryam Mirzakhani, an Iranian-born mathematician who in 2014 became the first woman awarded the Fields Medal, often called the most prestigious prize in mathematics, died July 14. She was 40.

Stanford University, where she had been a professor since 2008, announced her death but did not say where she died. The cause was breast cancer.

Dr. Mirzakhani grew up in Tehran and came to the United States in 1999 for graduate study at Harvard University. Her mathematical interests included the theoretical study of complex geometric shapes and the movement of billiard balls across surfaces.

Her work was deeply theoretical, but other mathematicians considered it boldly original and of untold future importance. Her doctoral dissertation, which she completed in 2004, solved two long-standing mathematical problems and led to publications in three major mathematics journals.

“She has a fearless ambition when it comes to mathematics,” her Harvard mentor, Curtis McMullen, a past Fields Medal winner, told Quanta Magazine in 2014.

Another academic collaborator, University of Chicago mathematician Alex Eskin, described her contributions as “the kind of mathematics you immediately recognize belongs in a textbook.”

Dr. Mirzakhani was particularly interested in the “geometric and dynamic complexities of curved surfaces,” Stanford said in a statement. These surfaces included spheres, amoebas and complex hyperbolic structures, or saddle-shaped or doughnut-shaped abstract objects with multiple openings. She also studied the dynamics of how particles move or flow across surfaces — like the trajectory of billiard balls rolling on tables of different configurations.

Her work is already widely influential in mathematics, with possible future use in engineering, cryptography and theoretical physics, including studies of the origin of the universe.

In 2014, she was one of four mathematicians to receive the Fields Medal — officially called the International Medal for Outstanding Discoveries in Mathematics, which is awarded by the International Mathematical Union. Sometimes called the equivalent of the Nobel Prize, it is presented every four years to no more than four mathematicians under the age of 40.

When Dr. Mirzakhani won the Fields Medal, it was considered a moment of great symbolic importance for women in mathematics and science. She is the only woman to have received the medal, named for Canadian mathematician John Charles Fields, since it was first awarded in 1936.

She often sketched mathematical proofs on large sheets of paper — a process her young daughter called “painting” and which Dr. Mirzakhani likened to composing a novel.

“There are different characters, and you are getting to know them better,” she told Quanta Magazine. “Things evolve, and then you look back at a character, and it’s completely different from your first impression.”

Maryam Mirzakhani was born May 3, 1977, in Tehran. In the few interviews she gave, she said that as a child, she wanted to be a writer, but she revealed nothing about her parents or their occupations.

She did say that she became interested in mathematics after her older brother told her about a shorthand way to add all the numbers from 1 to 100. The trick, devised in the 18th century by Carl Friedrich Gauss, is to add the outermost pairs of numbers: 1 plus 100, 2 plus 99, 3 plus 98, and so on. Each time, the sum is 101. There are 50 pairs of numbers. Multiplying 50 by 101 yields the answer: 5,050.

While attending a girls’ high school in Tehran, Dr. Mirzakhani earned gold medals in international math competitions, including a perfect score in 1995. She graduated from Tehran’s Sharif University of Technology in 1999 and received her doctorate in mathematics from Harvard in 2004.

She taught at Princeton University and was a research fellow with the Clay Mathematics Institute in New Hampshire before joining the Stanford faculty. Dr. Mirzakhani’s death was noted in a statement issued by Hassan Rouhani, president of Iran.

Survivors include her husband, computer scientist Jan Vondrak of Stanford, Calif.; and their 6-year-old daughter, Anahita.

“I don’t have any particular recipe,” Dr. Mirzakhani said in 2014 after winning the Fields Medal. But she said she derived a deep sense of joy from exploring mathematical problems.

“It is like being lost in a jungle,” she said, “and trying to use all the knowledge that you can gather to come up with some new tricks, and with some luck you might find a way out.”

Correction: An earlier version of this story incorrectly reported the date of Dr. Mirzakhani’s death. It was July 14, not July 15. The story has been revised.