Sally Ride, the first American woman to fly in space, died on Monday at her home in San Diego. She was 61.

The cause was pancreatic cancer, her company, Sally Ride Science, announced on its Web site.

Dr. Ride, a physicist who was accepted into the space program in 1978 after she answered a newspaper ad for astronauts, flew on the shuttle Challenger on June 18, 1983, and on a second mission in 1984. At 32, she was also the youngest American in space.

She later became the only person to sit on both panels investigating the catastrophic shuttle accidents that killed all astronauts on board — the Challenger explosion in 1986 and the Columbia crash in 2003.

Dr. Ride was finishing studies at Stanford University — she had degrees in physics and astrophysics (and also English) — and looking for a job when she saw NASA’s advertisement. She looked at the qualifications and said, “I’m one of those people,” she told The New York Times in 1982.

By the time she began studying laser physics at Stanford, women had already broken through into the physics department, once a boys’ club. And when she applied to the space program, NASA had already made a commitment to admit women.

But there were still rough spots. Speaking to reporters before the first shuttle flight, Dr. Ride — chosen in part because she was known for keeping her cool under stress — politely endured a barrage of questions focused on her sex: Would spaceflight affect her reproductive organs? Did she plan to have children? Would she wear a bra or makeup in space? Did she cry on the job? How would she deal with menstruation in space?

The CBS News reporter Diane Sawyer asked her to demonstrate a newly installed privacy curtain around the shuttle’s toilet. On “The Tonight Show,” Johnny Carson joked that the shuttle flight would be delayed because Dr. Ride had to find a purse to match her shoes.

The Soviets had already sent two women into space. When one came aboard a space station, a male cosmonaut welcomed her by saying the kitchen and an apron were all ready for her.

In her early days at NASA, Dr. Ride trained in parachute jumping, water survival, weightlessness and the huge G-forces of a rocket launch. She learned to fly a jet plane. She also switched from physics to engineering and helped in the development of a robotic arm for the space shuttle. The Challenger commander, Robert L. Crippen, chose her for the 1983 mission in part because of her expertise with the device. She was part of a crew of five that spent about six days in space, during which she used the arm to deploy and retrieve a satellite.

At Cape Canaveral, many in the crowd of 250,000 that watched the launching wore T-shirts that said, “Ride, Sally Ride” — from the lyrics of the song “Mustang Sally.”

The next day, Gloria Steinem, editor of Ms. magazine at the time, said, “Millions of little girls are going to sit by their television sets and see they can be astronauts, heroes, explorers and scientists.”

When the shuttle landed, Dr. Ride told reporters, “I’m sure it was the most fun that I’ll ever have in my life.”

Her next mission, in 1984, lasted about eight days. She was on the roster for another shuttle flight before the Challenger blew up on Jan. 28, 1986, 73 seconds after taking off from Cape Canaveral. But the program was immediately suspended, and she retired the next year.

As a member of the panel appointed by President Ronald Reagan to investigate the accident, Ms. Ride gained a reputation for asking tough questions. The panel learned from testimony and other evidence that there had been signs of trouble on earlier Challenger flights, but that they had been dismissed as not critical. Dr. Ride told a colleague it was difficult not to be angered by the findings.

One witness was Roger Boisjoly, an engineer who had worked for the company that made the shuttle’s rocket boosters and who had been shunned by colleagues for revealing that he had warned his bosses and NASA that the boosters’ seals, called O-rings, could fail in cold weather. The Challenger had taken off on a cold morning.

After his testimony, Dr. Ride, who was known to be reserved and reticent, publicly hugged him. She was the only panelist to offer him support. Mr. Boisjoly, who died in January, said her gesture had helped sustain him during a troubled time.

In 2003, after sitting on a shuttle-disaster panel for the second time, Dr. Ride said in an interview with The Times that part of the problem at NASA was that people had forgotten some of the lessons learned from the Challenger accident. The panel had months earlier expressed its conviction that the disintegration of the shuttle Columbia over Texas was triggered when a chunk of foam insulation fell off the external fuel tank and gashed the leading edge of the wing.

Photo

Dr. Ride with fellow crew members at the Kennedy Space Center in Florida before an October 1984 flight aboard the Challenger.Credit
Associated Press

But she also said: “I flew the shuttle twice. It got me home twice. I like the shuttle.”

In 1987, Dr. Ride led a study team that wrote a report advising NASA on the future direction of the space program. The team recommended an outpost on the Moon, though not a “race to Mars.” But Mars should still be the “ultimate objective,” the group said. In the report, Dr. Ride wrote that a lunar outpost would combine “adventure, science, technology and perhaps the seeds of enterprise.” She also noted darkly that the United States had “lost leadership” to the Soviet Union in a number of aspects of space exploration.

The same year, Dr. Ride retired from NASA and became a science fellow at the Center for International Security and Arms Control at Stanford. In 1989, she became a professor of physics and director of the California Space Institute at the University of California, San Diego.

She also developed a passion for trying to interest young people, especially girls, in science, math and technology. She wrote six science books for children, including one that explained how to make a sandwich in space. (She advised eating it fast, before it floated away.)

In 2001 she started a company, Sally Ride Science, to “make science and engineering cool again,” as she put it, by providing science-oriented school programs, materials and teacher training.

Dr. Ride was known for guarding her privacy. She rejected most offers for product endorsements, memoirs and movies, and her reticence lasted to the end. At her request, NASA kept her illness secret.

In 1983, writing in The Washington Post, Susan Okie, a journalist and longtime friend, described Dr. Ride as elusive and enigmatic, protective of her emotions.

“During college and graduate school,” Dr. Okie wrote, “I had to interrogate her to find out what was happening in her personal life.”

Dr. Okie quoted Dr. Ride’s younger sister, the Rev. Karen Scott, a Presbyterian minister, as saying, “ ‘Closeness’ is not a word that is often used to describe relationships in our family.” Dr. Ride always needed to be in control, her mother told Dr. Okie.

In a statement on Monday afternoon, President Obama said Dr. Ride had been “a national hero and a powerful role model.”

“She inspired generations of young girls to reach for the stars and later fought tirelessly to help them get there by advocating for a greater focus on science and math in our schools,” he said. “Sally’s life showed us that there are no limits to what we can achieve.”

Sally Kristen Ride was born on May 26, 1951, in Encino, part of Los Angeles. Her father was a political science professor at Santa Monica College, and her mother worked as a volunteer counselor at women’s correctional facility. Both parents were elders in the Presbyterian Church.

From an early age, Dr. Ride gravitated toward math and science. She was strong-willed and athletic, and became so obsessed with playing football in the street that her parents pushed her into tennis lessons because it was a safer sport. She was soon playing in tournaments.

Dr. Ride attended Westlake School for Girls, a prep school in Los Angeles. Dr. Okie was her schoolmate, and wrote that she and Dr. Ride, both on scholarship, felt out of place among the actors’ daughters and “Bel Air belles” at the school. Dr. Ride did not have to work hard for good grades, called herself an underachiever and refused to feign interest if she was bored in class. But it was at Westlake that Dr. Ride found a mentor and friend in Elizabeth Mommaerts, a science teacher whom she described as “logic personified.” A great enthusiast for research, Dr. Mommaerts invited her favorite students, Dr. Ride among them, to her home to sample French food and wine and to hear stories about her life in Europe.

(Later, in graduate school, Dr. Ride was devastated to learn that Dr. Mommaerts had committed suicide. When she was chosen to be an astronaut, the one person she wanted most to call was Dr. Mommaerts, she told Dr. Okie. “And I can’t,” she said.)

After graduating from high school in 1968, Dr. Ride attended Swarthmore College in Pennsylvania but quit after three semesters. She was homesick for California and was considering a career in tennis. She practiced for several hours a day, and also began taking physics courses at the University of California, Los Angeles. In 1970, she enrolled at Stanford as a junior. She played tennis for Stanford, became the team’s No. 1 women’s singles player and was nationally ranked. She taught at summer tennis camps, and at one of them she met Billie Jean King, who urged her to quit college and become a professional tennis player. She did not take that advice.

Years later, when a child asked her what made her decide to be a scientist instead of a tennis player, she laughed and said, “A bad forehand.”

She received bachelor’s degrees in physics and English in 1973 (her specialty was Shakespeare), a master’s degree in physics in 1975 and a Ph.D. in astrophysics in 1978, all from Stanford. Her graduate work involved X-ray astronomy and free-electron lasers.

In 2003, Dr. Ride told The Times that stereotypes still persisted about girls and science and math — for example the idea that girls had less ability or interest in those subjects, or would be unpopular if they excelled in them. She thought peer pressure, especially in middle school, began driving girls away from the sciences, so she continued to set up science programs all over the country meant to appeal to girls — science festivals, science camps, science clubs — to help them find mentors, role models and one another.

“It’s no secret that I’ve been reluctant to use my name for things,” she said. “I haven’t written my memoirs or let the television movie be made about my life. But this is something I’m very willing to put my name behind.”

Dr. Ride married a fellow astronaut, Steven Hawley, in 1982. They decorated their master bedroom with a large photograph of astronauts on the moon. They divorced in 1987. Dr. Ride is survived by her partner of 27 years, Tam O’Shaughnessy; her mother, Joyce; and her sister, Ms. Scott, who is known as Bear. (Dr. O’Shaughnessy is chief operating officer of Dr. Ride’s company.)

Dr. Ride told interviewers that what drove her was not the desire to become famous or to make history as the first woman in space. All she wanted to do was fly, she said, to soar into space, float around weightless inside the shuttle, look out at the heavens and gaze back at Earth. In photographs of her afloat in the spaceship, she was grinning, as if she had at long last reached the place she was meant to be.

Correction: July 25, 2012

Because of an editing error, an obituary on Tuesday about Sally Ride, the first American woman to fly in space, referred incorrectly to the death of Roger Boisjoly, an engineer who testified about the explosion of the space shuttle Challenger before a panel that included Dr. Ride. Mr. Boisjoly died in January of this year, not in February. The obituary also misstated the name and the location of the Southern California high school Dr. Ride attended. It was Westlake School for Girls in Los Angeles, not Westlake High School in Beverly Hills.

A version of this article appears in print on July 24, 2012, on page A1 of the New York edition with the headline: Coolly Shattered A Space Ceiling. Order Reprints|Today's Paper|Subscribe