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. His percentage increased from 64.6 to 71.2, putting him in good position to reach the necessary 75 percent next year. The highest percentage for a player who wasn't elected in a later year was 63.4 by Gil Hodges in 1983, his final time on the ballot.
Jim Rice was fourth with 346, his percentage dropping to 63.5 from 64.8 last year. He was 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.
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.
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.
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 spent their entire careers with one team, a rarity these days. They will be inducted during ceremonies on 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.