A man has been charged with murder over a shooting on the New South Wales Central Coast yesterday that was followed by a two-hour siege.

Police were called to reports of shots fired at Gertrude Street in Gosford about 2pm (AEST).

They found a 49-year-old man had barricaded himself inside a unit.

Specialist heavily armed police were called in and the man gave himself up after more than two hours of negotiations.

Officers then discovered the body of a 48-year-old man in a courtyard.

Police say the man had been shot in the head.

His alleged attacked spent the night in custody and is due to appear in Gosford Local Court today.

Acting Inspector John Goddard says officers and the general public responded well to the situation.

"A good result there with a peaceful resolution to what could've been a very dangerous situation and we do thank the public around that area for their co-operation and assistance in having that resolved really peacefully," he said.

"Any time there's a large police response obviously there are some issues but our police handled them well."