NEW YORK — 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 May 3 at his home in Princeton, New Jersey. 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 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.

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.

Wiles, now at the University of Oxford in England, wrote in an e-mail 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,” said Peter Sarnak, another Princeton mathematician. “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.

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

In a tribute to 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.”

Ribet of Berkeley said Dr. Shimura was “a major figure in 20th-century mathematics” but “not a good salesman for himself.”

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. Sarnak of Princeton recalled visiting Mr . 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,” Sarnak said. “By himself, almost always.”