John C. Stennis (D-Miss.), the courtly dean of the Senate, underwent surgery here yesterday for removal of his left leg because of cancer. He was reported to be in good spirits and stable condition at Walter Reed Army Medical Center.

The hospital, in a statement, described the surgery as successful and predicted that the 83-year-old Mississippian will be able to resume his Senate duties after "a normal period of convalescence."

A hospital spokesman said the operation was necessary because of a malignant tumor in Stennis' upper leg that "was affecting the femur, the bone in the thigh."

The oldest member of the Senate, Stennis also has the most seniority. He was first elected in 1947 and established a record for integrity, fair-mindedness and stamina. He was shot twice in a late-night holdup as he got out of his car in front of his Northwest Washington home in January 1973, but despite the loss of large quantities of blood he was back in the Senate that fall and within 17 months was leading a seven-day floor debate on a military procurement bill.

Yesterday's operation, which the hospital statement called "a relatively uncomplicated medical procedure," took about three hours and was completed around 11 a.m. By early afternoon, Stennis was "awake, alert" and talking with his two children and a grandson, a hospital spokesman said.

"He's going great, considering his age," the spokesman said. "His overall health is good."

Stennis' press secretary, Rex G. Buffington, said doctors are uncertain how long "the normal period of convalescence" will take, "but knowing him like we all do, we feel he'll be back as soon as he possibly can . . . . The phones here have been ringing off the hook, mostly from people encouraging him to take it easy. We don't expect him to heed that advice too much."

A former circuit court judge with a booming baritone voice, Stennis had been widely expected to retire or be retired on a number of occasions, but he always defied the predictions, most recently in 1982 when he defeated a vigorous young Republican opponent from Yazoo City to win a seventh term.

"You've got to be modern," he liked to tell reporters in that campaign, his first real fight since 1947. To help win it, Stennis hired his first campaign consultant, filmed his first television commercial, held his first fund-raiser (he had been accustomed to spending no more than $5,000) and visited each of Mississippi's 82 counties.

The ranking Democrat on the Senate Appropriations Committee, Stennis served for many years as chairman of the Armed Services Committee and is one of the Senate's leading experts on military affairs.

Friends said Stennis seemed to manage the late-night sessions before the Senate adjourned this fall in his usual fashion, but his office reported yesterday that the tumor in his thigh had been "bothering him for several months."

The tumor was said to have been localized. Stennis entered the hospital Wednesday for pre-surgical tests and preparations.

Buffington said the senator was eager to get back to work, which has become even more of his life since his wife, "Miss Coy," entered a nursing home a few years ago. She died last year.

"We're going to start out with a wheelchair and go from there," Buffington said in anticipation of a quick return to Capitol Hill, where Stennis lives. "He's very anxious about that. You know he's a determined man."