PARIS, NOV. 19 -- France's Socialist government tonight survived its most serious political challenge since taking power more than two years ago by narrowly defeating a vote of no confidence over its efforts to reform social security funding.

A censure motion introduced by the opposition in the National Assembly fell five votes short of a majority, the closest the opposition has come in nine attempts to bring down the government of Prime Minister Michel Rocard. For the first time, Communists joined right-wing and centrist politicians in voting against their former leftist allies.

The immediate cause of the challenge was an income levy that Rocard wants to impose to raise more than $7 billion for social services, for which costs have been steadily rising. But the government's problems have been multiplying rapidly as Rocard has tried to cope in recent weeks with angry street protests by students and farmers, charges of political corruption and growing unemployment.

Even some fellow Socialists have criticized Rocard, charging he has abandoned leftist programs and pursued economic and social policiesthat are too centrist. But the prime minister remains highly popular and is considered the leading candidate to succeed President Francois Mitterrand when his second and last term expires in 1995.