WASHINGTON (AP) _ Construction spending climbed 0.5 percent in October, the biggest increase in four months, as growth in residential building offset a big decline in construction of shopping centers and other commercial buildings, the government reported today.

The October gain left construction spending at a seasonally adjusted annual rate of $347.8 billion, 9.3 percent above the level of a year ago.

Residential construction rose 2 percent to an annual rate of $151.4 billion with construction of single-family homes rising by 2 percent and apartment construction jumping by 4 percent.

Nonresidential construction edged down 1 percent last month to $88.7 billion with the biggest downturn a 5 percent drop in building of shopping centers and other commercial units. Construction of office buildings was unchanged at a rate of $31.5 billion while construction of factories climbed 2 percent to $16 billion.

Government building projects posted a slight 1 percent gain to an annual rate of $64 billion.

Spending on military facilities posted the biggest increase in the public category, rising by 13 percent over the September rate. Government housing projects posted an 8 percent gain while spending for schools and water supply facilities rose by smaller percentages.

Government spending on highways edged down 1 percent while spending on sewer systems dropped 6 percent.

During the first 10 months of 1985, $285.7 billion in new construction has been put in place, 9 percent above spending for the same period in 1984.