Former senator John J. Sparkman, 85, an Alabama Democrat who served on Capitol Hill for more than four decades, who ran for vice president in 1952 and who chaired the Senate's Banking and Foreign Relations committees, died yesterday at a nursing home in Huntsville, Ala., after a heart attack.

Sen. Sparkman, who was elected to the Senate in 1946, was chosen by Illinois Gov. Adlai E. Stevenson as his 1952 running mate for the presidency. The Stevenson-Sparkman ticket, though finishing well ahead of President Truman's 1948 vote totals, was soundly defeated by the Republican ticket of Dwight D. Eisenhower and Richard M. Nixon.

Long an authority on housing, he served as chairman from 1967 to 1975 of what has become the Senate Committee on Banking, Housing and Urban Affairs. He then chaired the Senate Committee on Foreign Relations, widely considered the Senate's most prestigious assignment, until he retired from the Senate on Jan. 3, 1979.

He earned mixed reviews as chairman of Foreign Relations. Many of the more aggressive Democrats in Congress lamented the fall of the committee's preceding chairman, Sen. J. William Fulbright (D-Ark.) who was defeated in a 1974 primary election. They said that under Sen. Sparkman the committee had become a less important arena for foreign policy struggles.

What some saw as a change in the committee's importance, Sen. Sparkman saw as a philosophical adjustment. He told a New York Times reporter that his committee "does have an impact on foreign policy, but it doesn't make foreign policy, except insofar as the executive will take our advice and consent."

Although some members of Congress had seemingly endless disagreements with such executive branch figures as Secretary of State Henry A. Kissinger, Sen. Sparkman did not. He told reporters that Kissinger always came to the committee when asked, always answered questions, and always kept the committee briefed.

If the views and manners of Sen. Sparkman seemed outdated to some, they had a long and honorable tradition. Since the closing days of World War II, it had always been the goal of leaders of both parties to operate a "bipartisan" foreign policy. Much of the bipartisan spirit, and the accepted roles of the president and Congress, became casualties of the war in Southeast Asia.

The congressional career of Sen. Sparkman also was long and not without honor. Elected to the House of Representatives in 1936, he served there 10 years before winning a special 1946 election to the Senate. He served in the upper house until retiring. Along the way, he gained a reputation as one of the brightest and most articulate members of his era and as the personification of the moderate Southern wing of the Democratic Party.

Yet, he was a man of his time and place. Like all senators from the Deep South, he broke with the national Democratic Party over civil rights. In March 1948, he announced that he could not support the election of President Truman, and supported Strom Thurmond's 1948 "Dixiecrat" ticket. Though he continued to oppose much civil rights legislation, he successfully fought Dixiecrats for control of the Alabama Democratic Party organization.

At the 1952 Democratic convention he served on the platform committee where he was largely responsible for the civil rights plank that was acceptable to both North and South. It was the ability to gain compromise, as well as his popularity on Capitol Hill, that made him a logical choice for the vice presidential nomination.

During his decade in the House, he fought for the Tennessee Valley Authority, farm loans and Social Security. During World War II, he was a leader on the old House Military Affairs Committee and became the House Democratic Whip in November 1945.

During his Senate years he continued to support a strong bipartisan foreign policy, voting for NATO, the Marshall Plan aid program and generally supporting the executive branch of the government on foreign and defense issues. He became an authority on the problems of small businesses and fought for omnibus housing bills and for aid to education.

As head of the Banking Committee, Sen. Sparkman pioneered legislation ranging from the Housing Act of 1949, which established the federal urban renewal program intended to revitalize America's cities; to the Fair Credit Billing Act, which provides protection for both consumers and merchants. He also championed the fight for the small businessman. He authored and managed to enact such bills as the Small Business Act of 1953; the Small Business Investment Act and the Small Business Tax Act of 1958.

John Jackson Sparkman was born near Hartselle, Ala., on Dec. 20, 1899. The seventh of 11 children, he lived on a tenant farm until he was 21. The future senator sold a cotton crop he had raised, and with $75, entered the University of Alabama. He worked his way through the school, earning bachelor's, master's and law degrees. He also was elected to Phi Beta Kappa, served as student body president and edited the school paper.

Before entering Congress in 1937, he taught at Huntsville College in Alabama and served in the Army in World War I. He practiced law in Huntsville from 1925 to 1937. Since 1979, he and a grandson, Tazewell T. Shepard III, maintained the law partnership of Sparkman & Shepard in Huntsville.

In addition to his grandson, Sen. Sparkman's survivors include his wife of 62 years, the former Ivo Hall, of Huntsville, and a daughter, Julia Ann (Jan) Shepard of Washington.