BRUSSELS — Leaders of the 10-nation European Economic Community on Saturday endorsed an economic aid plan to bring Spain and Portugal into the world's largest trade bloc by Jan. 1.

Their two-day summit for a time had been threatened with failure because of Greek Prime Minister Andreas Papandreou's demand for special financial aid to cushion his country against competition from Spanish and Portuguese agricultural exports.

Papandreou's demands occupied most of the time at the summit until Greece finally settled for less than it originally sought and dropped its reservations against enlargement of the EEC, known informally as the Common Market.

"A cloud has been lifted," said Italian Prime Minister Bettino Craxi, who chaired the meeting.

Seven-Year Aid Package

The government leaders approved a $2.87-billion, seven-year aid package to help Greece, Italy and France cope with the problems of Spanish and Portuguese entry. About half of it will go to Greece.

In addition, $1.75 billion in loans will be made available to the Mediterranean nations to adapt to enlargement of the bloc.

The aid fell short of the $4.6 billion originally sought by Papandreou, who left the meeting early to attend the swearing-in of Greek President Christos Sartzetakis.

According to diplomatic sources, West German Chancellor Helmut Kohl accused Papandreou of wasting the time of the summit in order to divert attention from domestic political problems.

Belgian Premier Wilfried Martens expressed disappointment that as a result of the time spent dealing with Papandreou's problem, the summit had not been able to dedicate adequate attention to what was to have been the chief item on the agenda--the need to find solutions to the growing areas where European technology lags behind the United States' and Japan's.

'Lack of Political Will'

Martens said the summit "showed a lack of political will to tackle our economic problems as a community."

Still, despite the palpable sense of frustration at the end of the meeting, leaders expressed relief that the eight-year process to bring Spain and Portugal into the Common Market, creating a community of nearly 320 million people, was finally at an end.

"It is good for democracy and it extends democracy in a very troubled world," said British Prime Minister Margaret Thatcher.

"We have achieved something," Kohl said. "The road is free and the door open to the expansion of the European Community. I believe this is for the good of all, since national dimensions are no longer sufficient to cope with the problems of our time."

The six original members of the Common Market are France, West Germany, Italy, Belgium, Holland and Luxembourg. They were joined by Britain, Ireland and Denmark in 1973 and by Greece in 1981.