Goro Shimura, a mathematician whose insights provided the foundation for the proof of Fermat’s Last Theorem and led to tools widely used in modern cryptography, died on May 3 at his home in Princeton, N.J. He was 89.

The death was announced by Princeton University, where Dr. Shimura had been a professor from 1964 until his retirement in 1999.

In 1955, Yutaka Taniyama, a colleague and friend of Dr. Shimura’s, posed some questions about mathematical objects called elliptic curves. Dr. Shimura helped refine Dr. Taniyama’s speculations into an assertion now known as the Taniyama-Shimura conjecture.

But no one knew how to prove it.

The conjecture appeared unconnected to Fermat’s Last Theorem, a seemingly simple statement made by the French mathematician Pierre de Fermat in 1637: Equations of the form *a*^{n} + *b*^{n} = *c*^{n} do not have solutions when *n* is an integer greater than 2 and *a*, *b* and *c* are positive integers. (If *n* is equal to 2, the statement becomes the Pythagorean theorem, which says that the squares of the lengths of two sides of a right-angled triangle equal the square of the length of the hypotenuse; this equation — *a*^{2} + *b*^{2} = *c*^{2} — has many solutions where all of the numbers are integers. For example, 3^{2}+ 4^{2}= 5^{2}.)

In his writings, Fermat claimed that he had figured out a proof but that he did not have enough room to write it down. For centuries, mathematicians sought unsuccessfully to figure out what Fermat was referring to.

In 1986, Kenneth Ribet of the University of California, Berkeley, proved an intriguing connection: If Fermat’s Last Theorem were wrong, and there indeed existed a set of integers that fit the equation, that would generate an elliptic curve that violated the Taniyama-Shimura conjecture.

Thus, a proof of a form of the Taniyama-Shimura conjecture would also prove Fermat’s Last Theorem. In the 1990s, Andrew Wiles, then also at Princeton, figured out how to do just that, and Fermat’s Last Theorem had finally been proved true.

Dr. Wiles, now at the University of Oxford in England, wrote in an email that the Taniyama-Shimura conjecture was “a fundamental pivot in the proof of Fermat’s Last Theorem.” The proof also employed other key results of Dr. Shimura’s research, he said.

Dr. Shimura later expanded his work, and mathematicians now routinely talk about “Shimura varieties,” a fundamental concept in that area of mathematics.

“His works are fantastic,” Peter Sarnak, another Princeton mathematician, said in an interview. “His work encompasses laying the foundation to do things of this type in great generality.”

Alice Silverberg, a mathematician at the University of California, Irvine, who was a graduate student of Dr. Shimura’s, said that his work “permeates modern-day cryptography.” Researchers use Dr. Shimura’s ideas on elliptic curves to figure out how to devise encryption techniques that are harder to crack, and to decipher other people’s secret messages.

Goro Shimura was born on Feb. 23, 1930, in Hamamatsu, Japan, to Kurao and Yone Shimura. His father worked for a bank.

His childhood was shaped by World War II: The family’s home in Tokyo was destroyed in a bombing, although no one was hurt.

He attended the University of Tokyo, receiving a bachelor’s degree in 1952 and a doctorate in 1958.

In a tribute to Dr. Taniyama, who committed suicide in 1958, Dr. Shimura noted that in the aftermath of the war, he learned far more from his peers than from his professors. “I was influenced exclusively by the people of my generation, above all by Taniyama, and by none of those above the age of 30,” he wrote. “I think this applies in essence to him too. Indeed, his training ground was many seminars organized by the students themselves.”

Dr. Shimura taught at the University of Tokyo and Osaka University before becoming a visiting professor at Princeton in 1962. (He had earlier made visits to the Institute for Advanced Study, also in Princeton.)

“One thing was certain from my viewpoint,” Dr. Shimura wrote in a memoir, “The Map of My Life” (2008). “I had something to do in mathematics, and I viewed the United States as the best place for achieving my aim.”

In his memoir, Dr. Shimura praised some mathematicians but complained about others who, he said, minimized his contributions or asked annoying, trivial questions. “In spite of the fact my mathematical work was little understood by the general mathematical public,” he wrote, “I was often the target of jealousy by other mathematicians.”

Dr. Ribet of Berkeley said Dr. Shimura was “a major figure in 20th-century mathematics” but “not a good salesman for himself.” In the 1960s and ’70s, Dr. Shimura published long, difficult-to-follow papers, and it took others time to appreciate his advances.

He is survived by his wife, Chikako; a daughter, Tomoko Shimura; and a son, Haru.

Dr. Shimura’s awards included a Guggenheim Fellowship in 1979, the Cole Prize for number theory in 1976, the Asahi Prize in 1991 and the American Mathematical Society’s Steele Prize for lifetime achievement in 1996.

He wrote more than 100 papers and books. One book was not about mathematics but about Imari porcelain, which he collected for three decades.

He wrote almost all of his mathematical papers alone. Dr. Sarnak of Princeton recalled visiting Dr. Shimura’s house and seeing two desks in his office. In the morning, Dr. Shimura would work at one, exploring new ideas. In the afternoon, he would work at the second, polishing papers for publication. Once he made a breakthrough and finished a draft of a paper at the morning desk, he would place it in a drawer in the second desk and not return to it for about a year.

“A very meticulous and unusual way of working,” Dr. Sarnak said. “By himself, almost always.”