Met Office statistics showed the Shetland area had 192.9 hours of sunshine from 1-29 July, while Cornwall had 153.5 hours.
Shetland lies about 700 miles (1,130 km) to the north east of Cornwall.
It was a wet month for the UK as a whole, with 22% more than the average rainfall for July.
Properties were damaged and people had to be rescued after heavy rain and storms hit the Cornish village of Coverack.
Climate scientist Mike Kendon said while it hadn't been a remarkable weather month, there were some "significant events".
"It is uncommon for Shetland to experience more sunshine hours than Cornwall at this time of year," he said.
"There is also a notable gradient between a cooler, sunnier and slightly drier than average north-west and a wetter, dull and warmer than average south-east."
One of the wettest places in July was Hampshire - which received 118% more than its average rainfall for the month.
Northern Ireland was the wettest region of the UK, with 39% more rain the average.
Get news from the BBC in your inbox, each weekday morning

She met senior figures from the agricultural and food industries at the Royal Welsh Show near Builth Wells.
Ms Griffiths said she had seen a "real readiness to work together".
With farming fully devolved, Ms Griffiths said it was a chance to create policies and regulations "tailor-made for Wales' unique needs".
She told BBC Wales she wanted to hear about the best of EU regulations but she was aware of concern among farmers who voted for Britain to leave over "red tape".
Ms Griffiths held a meeting with representatives of Wales' rural affairs and environment sector to discuss the implications of Britain's impending withdrawal from the EU at the show on Monday.
Speaking before the meeting, she said: "I can't see how there wouldn't be a subsidy scheme, so while it's very uncertain, there are things that will have to happen."
Country Land & Business Association Cymru chairman, David Wynne-Finch, said the rural economy could thrive outside the EU "but only if our specific needs and opportunities are addressed in all aspects of planning and implementation of Brexit".
Plaid Cymru leader Leanne Wood said "we need to ensure that the level of support afforded to Welsh farmers in direct payments is at least as much after we leave the EU as it is now".
Under the current EU Common Agricultural Policy, Wales receives approximately £250m per year in direct payments to farmers in addition to more that £500m between 2014-2020 to run a rural development programme.
Ms Griffiths said she wanted to use Royal Welsh Show to reassure the industry and said it was an opportunity to "forge a new, distinct path for Wales' farming food and environmental sectors".
She added: "At the moment we're still in the EU, all the regulations and the funding are there, and we will ensure that we get that funding out as quickly as possible."
She said First Minister Carwyn Jones had already given her his assurance he would seek guarantees from the UK Government that Wales will not be financially worse off as a result of the UK leaving the EU.
"I believe the long term prospects for Welsh agriculture remain strong and I am committed to using this week to listen to the industry and ensure these views and ideas form the basis of our negotiations with the UK government over the terms of the UK's withdrawal from the EU," Ms Griffiths added.
The Royal Welsh Agricultural Society's President for 2016, Richard Jones, said this year's show was taking place at a time of unprecedented uncertainty for rural Wales.
"We don't know where this will lead us - hopefully to a better place," he said.
The Shetland Islands had more sunshine than Cornwall in July - only the eighth time this has happened since records began in 1929.
[NEXT_CONCEPT]
Brexit gives the chance for a "made-in-Wales" approach to farming in the future, Rural Affairs Secretary Lesley Griffiths has said.