Tarnished by accusations of steroid use, McGwire appeared on 128 of a record 545 ballots in voting released Tuesday by the Baseball Writers' Association of America.
Ripken was picked by 537 voters and appeared on 98.53 percent of ballots to finish with the third-highest percentage behind Tom Seaver (98.84) and Nolan Ryan (98.79).
The former Baltimore Orioles shortstop said he was both relieved and euphoric. If he had been picked by two of the eight voters who didn't select him, he would have set the percentage record — but he didn't mind.
"All I wanted to hear was, 'You're in,"' Ripken said during a conference call. "I really didn't get caught up with wanting to be unanimous or wanting to be the most."
"It's an unbelievable feeling to know that people think that what you did was worthy," Gwynn said. "For me, it's kind of validation. The type of player that I was doesn't get a whole lot of credit in today's game."
Goose Gossage finished third with 388 votes, falling 21 shy of the necessary 409 for election. Jim Rice was fourth with 346, followed by Andre Dawson (309), Bert Blyleven (260), Lee Smith (217) and Jack Morris (202).
McGwire was ninth, followed by Tommy John (125) and Steve Garvey (115), who was in his final year of eligibility.
McGwire's dismal showing raises doubts about whether he will ever get elected — players can appear on the BBWAA ballot for 15 years — and whether the shadow of steroids will cost Barry Bonds, Sammy Sosa and Rafael Palmeiro places in Cooperstown.
McGwire finished with 583 home runs, seventh on the career list, and hit 70 homers in 1998 to set the season record, a mark Bonds broke three years later. Gwynn was surprised McGwire received such a low percentage.
"I hope that as time goes on, that number will increase," Gwynn said. "I hope that one day he will get into the Hall of Fame, because I really believe he deserves it."
Ripken wouldn't give his opinion.
"I don't think it's my place to actually cast judgment," he said.
Jose Canseco, on the ballot for the first time, received six votes, well below the 5 percent threshold needed to stay on future ballots. In his book two years ago, Canseco accused McGwire and others of using steroids. The book's publication was quickly followed by a congressional hearing on steroids during which McGwire evaded questions, saying: "I'm not here to talk about the past."
Gwynn, who compiled 3,141 hits and a .338 batting average during his 20-year career with the San Diego Padres, said he was fidgety and nervous before he received the call from Jack O'Connell, the BBWAA secretary-treasurer.
"I broke down right away," he said. "My wife came over and put an arm around me."
Ripken played in a major league-record 2,632 consecutive games to break Lou Gehrig's ironman mark of 2,130, and set a new standard for shortstops with 431 home runs and 3,184 hits.
"I'm very proud of what the streak represents. Not that you were able to play in all those games, but that you showed up to play every single day," Ripken said last week.
Harold Baines, who received 29 votes, reached the 5 percent threshold. Bret Saberhagen got seven votes in his first appearance on the ballot and Ken Caminiti, who admitted using steroids during his career and died in 2004, received two.
Gwynn and Ripken raised to 43 the total of players elected in their first year of eligibility. That doesn't include Lou Gehrig (1939) and Roberto Clemente (1973), who were chosen in special elections.
Gwynn and Ripken each spent their entire major league career with one team, a rarity these days. They will be inducted during ceremonies held July 29 at the Hall in Cooperstown, N.Y., along with anyone elected from the Veterans Committee vote, which will be announced Feb. 27.
Ripken spent 21 seasons with Baltimore, hitting .276. A 19-time All-Star, he won the AL Rookie of the Year award in 1982, the AL MVP award in 1983 and 1991 and was a two-time Gold Glove shortstop.
Gwynn broke into the majors in 1982 and won eight batting titles to tie Honus Wagner's NL record. He made 15 All-Star teams and won five Gold Gloves as an outfielder.