Wapping Wall is a quiet street of converted warehouses now, the docks long gone and the river traffic reduced to tourist boats and the odd Thames Clipper. At No. 57, though, the past refuses to leave. The Prospect of Whitby is a three-storey, Grade II-listed building with a plain yellow-brick front, and from the street it gives little away. Step inside and the floor beneath your feet is made of great worn flagstones, said to be centuries old; the long bar is topped in pewter; old barrels and ship's masts are built into the fabric of the room; and through the windows at the back, the Thames slides past almost close enough to touch.

The pub's story begins around 1520, in the reign of Henry VIII, when a tavern called The Pelican opened on this stretch of the riverbank. Wapping was then a rough maritime hamlet beyond the City walls, and the Pelican drew the sailors, smugglers, thieves and river pirates who worked the Thames. Its reputation became so dubious that it was soon known as the Devil's Tavern. The name that stuck came later, from a collier ship called The Prospect, registered at Whitby, which was moored outside for so long that it became a local landmark. By the late eighteenth or early nineteenth century the tavern had taken its name, and apart from a brief spell as the Whitby Town in early Victorian times, it has kept it ever since.

Like most buildings of its age, the pub has been rebuilt more than once. A fire destroyed much of the old tavern, the front was refaced in yellow brick in the early 1800s, and the interior was refitted again in the 1950s. Yet more of the old building survives than most visitors realise. The flagstone floor is reckoned to be original, the first-floor dado panelling dates from the eighteenth century, and the pewter bar-top, a survivor of a style once common in Victorian pubs but almost entirely swept away by twentieth-century modernisation, is one of the rarest features of any pub in London.

The legends are as much a part of the place as the beer. Execution Dock, where pirates were hanged at low tide and left until three tides had washed over them, lay a short way along the river, and the Prospect plays up the connection with a replica gallows and noose hanging over the water behind the pub. Local tradition links the pub with Judge Jeffreys, the notorious hanging judge of Stuart England, and with the Arctic voyager Sir Hugh Willoughby, who is said to have set sail from here in 1553 on his ill-fated search for a north-east passage to China. Some regulars swear a ghost has been seen at the gallows. None of these stories can be proved, and none of them needs to be.

The guest list is more solid. Samuel Pepys and J.M.W. Turner are said to have drunk here, Charles Dickens inevitably knew it, and after the Second World War the Prospect became a fashionable destination, attracting film stars and, famously, Princess Margaret. In 1915 one guide to London described customers smoking their pipes over pots of beer on the open balcony, watching the barges go by. In 1953 the pub made headlines of a different kind when armed robbers forced staff and drinkers to lie down and made off with the takings. The river, it seems, has never quite stopped supplying the Prospect with drama.

Today the pub belongs to Greene King and is run as a traditional British pub, serving cask ales and familiar pub food, hand-battered fish and chips and a Sunday roast among the favourites. The bar downstairs keeps its dark, creaky atmosphere; upstairs, a covered first-floor balcony and terrace look out over the water, and there is a small beer garden on the riverside. It is family- and dog-friendly and hosts private functions. It is often busy, drawing tourists and Londoners in roughly equal measure, especially on summer evenings when the light on the river is at its best.

For the trade, the Prospect of Whitby is a reminder of what heritage can do for a pub in a hard market. Its location is not obvious, a riverside street a short walk from Wapping station rather than a prime high-street site, and yet it draws visitors from across London and around the world because of what it is and what it represents. Five hundred years of stories, a pewter bar and a view of the Thames are assets no newcomer can buy.

It is not a gastropub, and those looking for ambitious cooking will find the menu straightforward. The crowds at weekends can make it hard to find a seat by the window. But few pubs anywhere offer such a direct line to the past.

Pirates, painters and princesses have all crossed these flagstones, and the tide has risen and fallen beneath the balcony twice a day for half a millennium. The Devil's Tavern has long since mended its ways. But stand at the bar on a winter's evening, with the river dark outside and the gallows creaking in the wind, and it is not hard to imagine the old Wapping waiting just beyond the door.

The Prospect of Whitby | 57 Wapping Wall, Wapping, London E1W 3SH | Tel: 020 7481 1095 | Website: Official website