Prime Minister Bettino Craxi answered protests from critics of his foreign policy and won a final vote of confidence in the Senate today that seemed to guarantee him a place in history books as Italy's longest ruling prime minister since World War II.

Before his final speech to Italy's 322-seat Senate there had been serious questions of his ability to win the vote of confidence because of a speech before the Chamber of Deputies Wednesday defending the legitimacy of violent tactics by the Palestine Liberation Organization. But today Craxi toned down his rhetoric about the PLO and won the applause of senators from his five-party coalition that only hours earlier had threatened to rebel.

The final vote in favor of Craxi's government continuing in power after two years and three months was 180 to 102 with one abstention. If Craxi's government can last another week and a half, it will have established a new longevity record for Italian postwar politics.

The question being asked after this turbulent week is not whether Craxi's reconstituted coalition government will reach the magic date of longevity Nov. 17, but how much longer beyond that it can survive given the deep differences over policies and personalities among the ruling coalition that were exposed during the crisis.

Ever since Craxi's government was shaken by the hijacking of the Achille Lauro off the coast of Egypt a month ago, Craxi, a Socialist, has been at loggerheads over his Middle East policy with Defense Minister Giovanni Spadolini, who heads the small Republican Party.

The differences led Spadolini to withdraw his three Cabinet ministers from Craxi's government, forcing Craxi to offer his resignation to President Francesco Cossiga. The conflict was patched up when Craxi agreed to a coalition foreign policy document that softened the language on the Italian government's support for the PLO.

That compromise seemed to set the basis for the resolution of the government crisis. Cossiga, in an unusual act, refused to accept Craxi's resignation and ordered the old government to present itself for a vote of confidence.

When Craxi went before the Chamber of Deputies on Wednesday, he suddenly reopened all the old wounds with Spadolini, and even with the powerful Christian Democrats in his coalition, by defending the legitimacy of the PLO's resorting to armed violence.

Although he won the Chamber of Deputies vote Wednesday, the main parties in his coalition threatened to vote against him in the Senate unless he "clarified" his statements.