There was an audible intake of breath when the Sainsbury Laboratory, by Stanton Williams, was announced as the Stirling prize winner in Manchester on Saturday night.  It was neither the critics' favourite, nor the bookies', nor did it come anywhere near the top of public polls. Most people in the room – including many of the critics – hadn't even been to see it.  The Lyric Theatre in Belfast, by O'Donnell and Tuomey, had wowed the press and seemed the firm frontrunner. Designed from the inside out, it takes you on a three-dimensional journey through a masterfully crafted sequence of spaces, built on a challenging hillside site for only £18m.  The Hepworth Gallery in Wakefield, by David Chipperfield, was perhaps the most photogenic project on the list, a cluster of chiselled concrete containers rising from the churning waters of the River Calder, a robust response to its industrial context. The Olympic Stadium, by the appropriately named Populous, was the people's choice, bathed in the afterglow of televised spectacle – and a fine thing it is, the lightest and leanest of its kind.  But instead of these, the building of the year was a project that has received few headlines: the swish Rolls Royce of science laboratories, an £82m new facility that lurks behind the trees in Cambridge's Botanic Garden. Here Stanton Williams has recast what might once have been an anonymous prefab shed, housing a functional stack of labs and pipes, into nothing short of a temple to botany.  "Plant science is often seen as the poor cousin of the sciences," said architect Alan Stanton on Saturday night, explaining how the building has become something of a recruiting tool, luring the best scientists from across the world. "It's actually an area of fantastic potential development and of course vital for the sustainable future for the planet." After visiting this complex, generously funded by Lord Sainsbury's Gatsby Charitable Foundation, "poor" is one of the last words I would use to describe the current state of plant science.  The site, in south Cambridge, has a long history as a cradle of botanical research, since the university gardens were established here in the 1830s by John Stevens Henslow, tutor of Charles Darwin. Conceived as a practical outdoor lab, the gardens were planted with exotic trees and a series of herbaceous "systematic beds", all laid out according to Henslow's theory of species. It was while meandering along the paths that loop around the garden that Darwin and Henslow would debate such theories; and it is this Aristotelian tradition of strolling, deep in discussion, that the architects have tried to manifest in the form of their building.  The lab complex sits in the "working" part of the garden, which makes the presence of a gleaming stone sanctuary all the more startling. It has a monumental presence, composed in the planar language of high modernism that Stanton Williams has carefully refined over its 27-year practice history. A long frieze of buttery limestone fins marches along the first floor, defining this upper level of laboratory spaces, held taut between two crisp concrete planes. This horizontal beam appears to float, cantilevered out above a sunken ground floor.  The interior is planned around a double-height "internal street" that frames two sides of an open courtyard, fully glazed to allow views to different parts of the building. It is a form that draws on a long history, from the Greek stoa to monastic cloister and collegiate quad, of semi-enclosed contemplative spaces – here enlivened by a cafe on one side, which gives the institution a welcome public face.  Within, the building's main spaces are linked by a continuous route, inspired by Darwin's "thinking path" and designed to promote chance encounters, dotted with informal areas to sit and chat. Wooden cubbyholes line the first floor windows, while staircases are broad, allowing two people to walk and talk side by side. The labs are generous and airy, flooded with natural light from curved funnels, with glazed walls which let other people see what's going on.  It is entirely unlike most research buildings, a far cry from the usual warrens of endless corridors and closed doors behind which new discoveries are squirreled away. It is hoped that this open layout will change the way of working, fostering a more collaborative approach – and although only half-occupied so far, it seems to be working well.  In her summing up, Stirling judge Joanna van Heyningen described the importance of this project as "the lifting of a building type that could have been utilitarian into … a sublime piece of calm and beautiful architecture". And perhaps that is enough to make it a winner.  Too often, the Stirling shortlist favours arts and cultural projects over buildings that perform complex functions or provide routine backdrops to our daily lives. Formal novelty has frequently trumped thoughtful pragmatism. And while it might be hard for the Sainsbury Laboratory to have gone badly wrong – given the generous patronage, enlightened client and dream site – Stanton Williams has reinvented this difficult typology, an achievement that could have an important influence beyond this one building.  • This article was amended to correct the cost of the Sainsbury Laboratory in the standfirst.
Most critics hadn't even seen Stanton Williams' £82m botanical temple when it beat the favourites to win architecture's top prize. Oliver Wainwright explains why the judges got it right