Businesses in Scotland increased spending on research and development by 2.1%, after taking account of inflation in 2012 when investment fell by 4% across the UK as a whole, official figures show.

However the spend per head of the population in Scotland was less than half the level recorded in the UK.

The Scottish Government said business R&D spending increased by £14.5 million in real terms north of the border in 2012, to £707m, from £692.5m in 2011.

Spending in the UK fell by around £700m to £17.1bn.

The figures mean Scotland made some progress towards closing the gap between the amount invested in total in areas like product development and boosting efficiency in the country and in the UK.

Scottish Government statisticians noted business expenditure on R&D as a percentage of national output had historically been lower in Scotland than in other countries.

The increase in spending in Scotland was recorded amid challenging economic conditions.

But the average spend per head of population was £103 in Scotland in 2012 compared to £269 per head in the UK.

There were wide variations in spending between different industries and areas in Scotland.

Manufacturing firms increased spending by 5.4% in 2012, £24m, to £462m. Services firms raised investment by 6.4%, £11m, to £180m. Expenditure on R&D in other sectors fell 23.6%, £20m, to £65m.

Some 24.9% of the total business R&D budget was spent in the City of Edinburgh council area. West Lothian accounted for 13.5%, while around 9% was spent in each of Aberdeen and North Lanarkshire.

Businesses in the city of Glasgow accounted for 7.5% of the total.

US-owned firms were responsible for 38% of expenditure in Scotland, while 32% came from Scottish based businesses. Firms based in other parts of the UK funded 3%.

More than a quarter, 28%, of total spending was accounted for by the pharmaceuticals and precision instruments and optical products sectors.

The statisticians said: "R&D expenditure in Scotland can fluctuate significantly year on year, especially given that R&D expenditure is concentrated in a small number of big companies."

In 2012, five firms accounted for almost a third of Scottish R&D expenditure. They were not named.

Scotland ranked eighth of 12 regions/countries in terms of its share of total R&D expenditure (3.9%) in the UK . South-east England ranked top, accounting for 26.2% of the total. Wales and north-east England, at 1.5% had the lowest share.