Willie McCovey, the Hall of Fame first baseman who spent 19 of his 22 major-league seasons with the Giants and became one of the most beloved players in franchise history, has died at the age of 80.

McCovey died at Stanford Hospital on Wednesday afternoon after what the team called “a battle with ongoing health issues.” He had used a wheelchair for many years and had a serious infection four years ago that nearly took his life. McCovey recently developed another infection and was hospitalized late last week.

During the Giants’ final home game of the season, McCovey was rushed to the hospital but returned home shortly thereafter, before he was hospitalized for the final time.

Fellow Hall of Famer Joe Morgan, who grew up in Oakland and was one of McCovey’s baseball contemporaries and a close friend, was at McCovey’s bedside for his final hours Wednesday. Morgan marked the time of death at 4 minutes past 4 in the afternoon.

McCovey wore uniform No. 44.

“You just don’t like to see people you love suffer,” said Morgan, whose mother recently died. “I felt both suffering. Pain is a terrible thing. I’ll be sad for a while, but his suffering is over.”

In a statement, Giants President and CEO Larry Baer said, “San Francisco and the entire baseball community lost a true gentleman and legend, and our collective hearts are broken.”

The statement also quoted McCovey’s daughter, Allison. “I am grateful that my father passed peacefully surrounded by his family and friends while listening to his favorite sports channel,” she said.

Hall of Famer Orlando Cepeda, McCovey’s teammate for eight years, said when reached at his home Wednesday night, “I’m very broken up. He was not only a teammate but a brother.”

McCovey teamed with Willie Mays to give the Giants one of the most feared duos in baseball history, but he played in only one World Series.

It was McCovey’s line drive to Yankees second baseman Bobby Richardson in the bottom of the ninth inning of Game 7 that ended the 1962 Series and — until the Giants broke through in 2010 — represented the closest the franchise would come to winning a title on the West Coast.

McCovey was a fearsome hitter during his heyday in the 1960s and ’70s, not merely because of his prowess — he hit 521 home runs (still tied for 20th on the all-time list, 38 years after he played his last game) — but because of how hard he hit the ball.

He played 22 seasons in the majors, all but three with the Giants, when he played in San Diego and had an 11-game stint in Oakland.

The list of McCovey’s accomplishments seems almost as long as some of his prodigious home runs. A few of the most notable:

•1959 National League Rookie of Year;

•1969 National League Most Valuable Player;

•1977 National League Comeback Player of the Year;

•18 grand slams, most in National League history;

•Six-time All-Star.

The Giants honored McCovey in many ways. They retired his No. 44 in 1980, his final season. That year the team also established the Willie Mac Award, a de facto most inspirational player award, coveted by San Francisco players because of McCovey’s history and the fact that the honoree is selected by teammates.

When the team moved into the ballpark at China Basin in 2000, the name McCovey Cove — an idea of sportswriters Mark Purdy and Leonard Koppett — quickly took hold. As the thinking went, if the left-handed McCovey had played in that ballpark, he would have deposited dozens of balls into the water beyond the right-field fence.

Then in 2003, the Giants unveiled a monument to McCovey at China Basin Park, on the other side of the cove. The statue depicts him at the finish of one of his mighty swings, his gaze skyward, watching another baseball soar majestically over a right-field wall.

Despite two arthritic knees that required countless surgeries, and an infection from one operation that nearly killed him in 2014, McCovey continued to attend Giants games. Fans, most of whom never saw him play, cheered McCovey as he rode through the tunnel at AT&T Park in a golf cart.

In early August McCovey married his longtime girlfriend, Estela Bejar, at AT&T Park. In late September he was on the field to present this year’s Willie Mac Award to reliever Will Smith.

As part of the award tradition, McCovey would take the field before the opening game of the final home series each year and announce the winner.

McCovey, the son of a railroad worker who was born and raised in segregated Mobile, Ala., about 250 miles from teammate Willie Mays’ hometown, made his major-league debut July 30, 1959.

The 10,114 fans at Seals Stadium got a pretty good inkling McCovey would have a brilliant career.

The New York Giants had signed McCovey in 1955. Playing for the San Francisco Giants’ Triple-A team in Phoenix four years later, McCovey was batting .372 with 29 homers and 92 RBIs when he received that late July call-up.

All McCovey did in his debut game at the age of 21 was go 4-for-4 with two triples against future Hall of Famer Robin Roberts as the Giants beat Philadelphia 7-2.

The Chronicle’s Bob Stevens wrote that McCovey, “whom they call ‘Stretch,’ arrived at Seals Stadium just before game time and wound up owning it.”

After the game, McCovey was asked whether there was any difference between Roberts and Pacific Coast League pitchers.

“It didn’t seem so today,” McCovey deadpanned.

Though he played in only 52 games, McCovey was the unanimous choice of the Baseball Writers’ Association of America as the NL Rookie of the Year. He hit .354 with 13 homers and had a 22-game hitting streak.

In 1960, McCovey slumped to a .238 average, and he spent a 17-game stint back in the minors.

Two years later, he became a central figure in a moment where the Giants were oh-so-close to winning a World Series title in San Francisco.

The scene: The Yankees owned a 1-0 lead in the ninth inning in Game 7 at Candlestick Park. With two outs, the Giants had Matty Alou at third and Mays at second. Right-hander Ralph Terry was on the mound. McCovey was at the plate.

Stevens’ account in The Chronicle noted, “Yankee manager Ralph Houk had the audacity to permit Terry to pitch” to the left-handed power hitter.

McCovey hit a foul ball on the first pitch. The next pitch, Stevens wrote, “was over the heart of the plate, belt high, and did Willie ever belt it. It rushed out to Richardson as fast as a ball can go from plate to an inner-defense man, and Bobby grasped it, peeking through the webbing of his glove.”

Thus did the New York second baseman snatch a World Series title from the Giants. Two months later, Charles Schulz’s “Peanuts” cartoon captured Giants fans’ sentiments. Schulz had Charlie Brown ask, “Why couldn’t McCovey have hit the ball just three feet higher?”

In January 1986, after McCovey had been voted into Cooperstown, he was asked how he’d like to be remembered.

“I’d like to be remembered as the guy who hit the ball over Bobby Richardson’s head in the seventh game,” McCovey responded.

McCovey, born on Jan. 10, 1938, could hit the ball hard even as a child. He recalled his earliest memories of baseball in a 2017 interview with the Wall Street Journal.

“At night, we’d gather around the radio to listen to a guy who recreated the play-by-play of major-league baseball games by reading the ticker,” McCovey said. “With sound effects, he made it seem real.

“My friends and I played sports in the streets or empty fields. We played softball in a large local playground. Jesse Thomas was the director. I pitched and was a better pitcher than a first baseman. But I could hit the ball hard.”

From 1962 through ’64, McCovey and Cepeda alternated between first base and the outfield. Each was more suited to play first. When the Giants traded Cepeda to St. Louis in 1966, the first-base job became McCovey’s for nine seasons.

For the bulk of that time, Mays and McCovey were one of the most formidable 3-4 spots in a batting order in big-league history. Each man knew how much the other meant to him.

In a first-person article in the Examiner in 1980, McCovey said, “I don’t think it is humanly possible for anyone to be a better and more complete player than Willie Mays was. ...

“I saw him do some ... things on a baseball field that no other human being could do.”

One of the subtle things Mays occasionally would do was avoid stretching a single into a double simply so that the opponent wouldn’t intentionally walk McCovey.

McCovey “could hit a ball farther than anyone I ever played with,” Mays said in 1986. “You could talk all day about balls he hit.”

Having teammates talk about you is one thing. Having opponents do so is quite another. At 6-foot-4, McCovey was a towering presence at the plate. He would take a few of his distinctive uppercut practice swings, then be ready to unload on a pitch.

His home runs seemed to go farther, his line drives more vicious than almost anyone’s.

Longtime Cincinnati Reds manager Sparky Anderson would say he feared McCovey more than any other hitter.

“When he belts a home run,” longtime Dodgers manager Walter Alston said, “he does it with such authority, it seems like an act of God. You can’t cry about it.”

“I think it’s fair to say McCovey has never been as highly acclaimed as he deserved,” longtime Dodgers pitcher Don Sutton said in 1986. “He easily was the most feared hitter in the league.”

Claude Osteen, another former L.A. pitcher, said, “He never was going to get cheated on his swings.”

“He used to scare me the most when I was playing first base,” said Joe Torre, who spent the bulk of his playing career as a catcher. “I was just praying he wouldn’t hit one down the line. He was one of the most awesome players I’ve ever seen.”

One of Torre’s St. Louis teammates, pitcher Bob Gibson, said, “McCovey swung harder than anyone I ever saw. Most guys who swung that hard would miss the ball, but he didn’t.”

Pitcher Roger Craig, who would manage the Giants for seven-plus seasons (1985-92), recalled a time his manager with the Mets, Casey Stengel, went to the mound with McCovey at the plate.

McCovey’s top individual season was 1969. He batted .320 and led the National League in home runs (45) and RBIs (126). McCovey had the distinction of winning the Most Valuable Player Award in the All-Star Game (he homered twice in the NL’s 9-3 win in Washington) and for the National League.

“Certainly I’m happy and proud to win the MVP,” McCovey said after receiving the league honor, “but I’d gladly give it away to play in another World Series.”

He would not do so. The Giants won the NL West in 1971 but lost to Pittsburgh in the National League Championship Series. He went 6-for-14 with two homers and six RBIs in the four games.

The great unanswerable question about McCovey’s career: How much better would it have been had he not endured so many injuries and so much pain, particularly in his arthritic knees?

After yet another knee surgery, McCovey said in 2005, “Lord, I’ve even lost count how many. It’s at least a dozen on each knee.”

Perhaps believing that the injuries and operations had taken too big of a toll on McCovey, the Giants traded him, along with outfielder Bernie Williams, to San Diego for pitcher Mike Caldwell after the 1973 season.

“McCovey has given the Giants a great many years of great service,” then-manager Charlie Fox said, “but there comes a time you have to give way to the young people.”

The trade wasn’t a complete shock — the Giants had dealt Mays to the Mets a year earlier — but McCovey, who hit 29 homers in 1973, wasn’t ready to concede his career was near its end.

“I’m just 35,” he said, “and I can still play three or four more years on the field. I feel in pretty good shape and stay in good shape.”

After two solid seasons with the Padres, McCovey hit .203 for them in 1976. In late August, San Diego sold him to the A’s, with whom he went 5-for-24 without an extra-base hit.

In January 1977, the Giants brought McCovey back into their organization. They invited him to spring training, but he didn’t sign a contract until late March, after he’d performed well in Arizona.

“I’m fortunate,” McCovey said. “Joe didn’t judge me on my last two years in San Diego or on my age (39). … It would have been easy for Joe to look at my age and assume it was all over.”

Said Altobelli: “We didn’t want Willie to embarrass himself. He has done just the opposite. He’s had a super spring and he’s a super person. If I had his body — and I’m 45 — I think I’d still be playing, too.”

McCovey rewarded Altobelli’s faith in him by winning the National League’s Comeback Player of the Year award. McCovey’s 1977 numbers: .280, 28 homers and 86 RBIs.

The next two seasons, McCovey shared the Giants’ first-base job with Mike Ivie. With Ivie and supposed future star Rich Murray (brother of Hall of Famer Eddie Murray) pushing for playing time in 1980, and with McCovey struggling at the plate (he batted .204 that season), McCovey decided in late June to retire, effective at the All-Star break.

Said McCovey: “I’ve been in this position before, only from the other side. I’ve said that when a young phenom came up who could take my place, I’d go away. That phenom, Rich Murray, has arrived. When I came up as a ‘young phenom,’ Hank Sauer retired.”

Rich Murray’s career would not be described as McCovey-esque: Murray played in a total of 57 games, batting .216 with four homers.

Bob Lurie, then the Giants’ owner, said McCovey “wrote the necessary letter of voluntary retirement. It was as tough a decision for him to make as it was for me to accept.”

McCovey had, in effect, three farewell games. The first came in the opener of a doubleheader against the Dodgers on June 29. In front of 50,229 fans at Candlestick Park, McCovey came to the plate as a pinch-hitter with two outs in the ninth inning. He doubled off Bobby Castillo, driving home Rennie Stennett from first base with the winning run. The Giants prevailed 4-3.

His teammates mobbed McCovey, and the fans had him return from the clubhouse for a curtain call.

“That was one of the great moments I’ve ever seen in sports,” said then-Giants coach Jim Lefebvre, a longtime Dodgers infielder.

Four days later, in his last appearance at Candlestick, McCovey made his final start. He went 1-for-4 with an RBI single as the Giants beat Cincinnati 4-3.

A large crowd and media contingent for a weekday afternoon game surprised McCovey.

“I don’t think I’ve ever gotten the recognition that my type of career deserves,” he said. “I was shocked that my retirement caused this much commotion.

“Too bad I had to retire to find that out.”

McCovey produced one more moment to savor. On July 6 at Dodger Stadium, in his last big-league plate appearance, his pinch-hit sacrifice fly in the eighth inning helped the Giants to a 7-4, 10-inning victory.

The Los Angeles fans gave McCovey a proper send-off after the sacrifice fly. As The Chronicle’s Bruce Jenkins wrote, “McCovey was called back by a deafening ovation, and he was clearly moved. With a huge smile on his face, he raised his hands high, then made a sweeping bow.”

“I have delayed reactions to things like this,” McCovey said after the game. “I don’t think all of this will sink in until spring training, when the reporting dates come out and I don’t get one. And Opening Day … that’s when I’ll realize it, when I might shed a tear or two.”

In retirement, McCovey was popular on the autograph circuit. In 1995, he and retired Brooklyn Dodgers outfielder Duke Snider were convicted of tax fraud for failing to report income earned at autograph and memorabilia shows. In 1996, McCovey was sentenced to two years probation and fined $5,000.

Just before leaving office in 2017, President Barack Obama pardoned McCovey.

McCovey might have gotten misty-eyed a few times in 1986. In January he was elected to the Hall of Fame, becoming the 16th player to receive that honor in his first year of eligibility.

“To tell you the truth,” he said, “I wasn’t surprised. I was more relieved than anything else.”

On an early August day in Cooperstown, McCovey took his place among the greatest in the history of the game.

“I’m a pretty calm person,” he said after the ceremony, “and I thought I could get through the afternoon without getting too emotional — but it hit me when I got up on the stage.”