Dismantled stone by stone from its perilous clifftop perch, Clavell Tower - a 19th-century folly immortalised by Thomas Hardy and the crime novelist PD James - will reopen today.

The turret above Kimmeridge Bay in Dorset was threatened by shoreline erosion and was in imminent danger of toppling into the churning ocean below. It has been saved by being rebuilt 25 metres (82ft) inland.

The monument was constructed for the Rev John Richards Clavell in 1830 as an observatory and folly, with four storeys, including a basement, and a Tuscan-style colonnade.

It was used by coastguards in the late 19th and early 20th centuries, but fell into disuse and became derelict after being gutted by fire in the 1930s.

Hardy was a frequent visitor. He courted his first love, Eliza Nicholl, there and included a sketch of the tower opposite the title page in his Wessex Poems. Also known as the Tower of the Winds, the building was the scene of a murder in James's mystery The Black Tower. The author was a prominent supporter of the campaign to save the building.

The Grade II-listed monument, with commanding views along the World Heritage Site coast, has been restored by the Landmark Trust and will be open to the public between 10am and 4pm this Sunday and Monday. It will be rented out for holiday lets.

The 18-month relocation project cost £898,000. Each of the tower's 16,272 stones was numbered before they were reassembled in a slight dip inland from the crumbling cliff. The last stone was placed in February. The tower used 298 new carved stones, about 1.5 miles of pipes and cables, 10 tons of render on the walls, 1,344 bags of lime and about 100 tons of sand.

Peter Pearce, director of the Landmark Trust, said: "The tower's future is secure and it can now resume its role as sentinel on this stretch of coastline. Its familiar silhouette will continue to welcome the many thousands of people who visit Kimmeridge Bay each year."

The trust, leaseholder of the tower, launched an emergency appeal in 2004 to raise money to save the monument and secured a contribution of £436,700 from the Heritage Lottery Fund.

The building preservation charity hopes that the tower's maintenance will be paid for by rental income from holidaymakers. The monument accommodates two people, with a double bedroom and sitting room on the top floor, with 360-degree views of the surrounding coast and countryside. There is a bathroom in the basement. The building will be available to visit by appointment and on public open days.

Designed by the architect Robert Vining, who also built Georgian terraces along the seafront at Weymouth, the tower was raised from stone quarried locally from the Smedmore estate around Kimmeridge Bay.

The clifftop stands about 100 metres (330ft) above the sea. "At the current rate of erosion we believe it should be safe for the next 200 years," the trust said.