King Juan Carlos today signed a decree dissolving parliament and calling for early elections that could bring to power the first left-wing administration here since the civil war nearly 50 years ago.

The move came at the request of Premier Leopoldo Calvo-Sotelo, who flew to Juan Carlos' summer residence on the island of Mallorca immediately after a Cabinet meeting. The premier said in a broadcast that elections would be held on Oct. 28. The four-year legislature was not due to end until next March.

Early elections have been prompted by splits and defections in the governing Union of the Democratic Center, which has played a pivotal role in Spain's transition to a parliamentary monarchy ever since it won the first post-Franco elections five years ago.

The front-runner in opinion polls is the opposition Socialist Party, whose leader, Felipe Gonzalez, 40, has been the chief advocate of a fall election. The Socialists scored a runaway victory in regional elections last May in the southern region of Andalusia, and recent polls indicate they could get nearly 40 percent of the national vote.

In contrast to the Socialist success, the Democratic Center has been wracked by internal feuding and a succession of splits among its supporters in the 350-member Congress, or parliament. The most damaging defection came last month when former prime minister Adolfo Suarez, a founder of the party and the chief architect of the transition process, announced he would contest elections under a new ticket.

Support in the legislature for the Democratic Center is estimated to have fallen from 168 members in Congress after the 1979 elections to fewer than 130 now, the same as the Socialists. Calvo-Sotelo said his party could no longer assure parliamentary support for the government.

Under Gonzalez's leadership the Socialists have sought an image of moderation and played down left-wing ideology. The electoral program being drawn up by the Socialist leadership is said by party sources to be a broad appeal to the moderate voter that eschews controversial nationalizations and has the modernization of Spain as its theme.

Party leader Gonzalez has consistently stressed that his main task was to consolidate Spanish democracy and not to build socialism. In the wake of the attempted military coup in February 1981, he said his priority was not to win the next elections but to ensure that they would be held.

A casualty of the election could be a papal visit to Spain that is scheduled for mid-October. Pope John Paul II's week-long trip would coincide with final days of the campaign, and church leaders have indicated that the visit could be postponed.