A political press agent or publicist employed to promote a favourable interpretation of events to journalists.
This is of American origin and came about during the 1980s, when the need for 'sound bites' became pressing enough to require a new class of publicist to provide them. The earliest printed references are from that period, For example, this from The New York Times, October 1984:
"A dozen men in good suits and women in silk dresses will circulate smoothly among the reporters, spouting confident opinions. They won't be just press agents trying to impart a favorable spin to a routine release. They'll be the Spin Doctors, senior advisers to the candidates."
So, why 'spin'? For the derivation of that we need to go back to yarn. We know that sailors and other storytellers have a reputation for spinning yarns. Given a phrase in the language like 'spin a yarn', we might expect to assume that a yarn was a tall tale and that the tellers spun it out. That's not quite right though. Until the phrase was coined, yarn was just thread. The phrase was coined as an entity, just meaning 'tell a tale'. That came about in the early 19th century and was first written down in James Hardy Vaux's A new and comprehensive vocabulary of the flash language, in 1812:
"Yarning or spinning a yarn, signifying to relate their various adventures, exploits, and escapes to each other."
So, spin became associated with telling a story. It began to be used in a political and promotional context in the late 1980s; for example, in the Guardian Weekly, January 1978:
"The CIA can be an excellent source [of information], though, like every other, its offerings must be weighed for factuality and spin."
From there it is a small step for the people employed to weave reports of factual events into palatable stories to be called 'spin doctors'.
In the UK, the two best-known exponents of the spin doctor's two functions, that is, political press agent and publicist are, respectively, Alistair Campbell, until 2003 Tony Blair's Director of Communications and Strategy, and the publicist Max Clifford.
See other phrases that were coined in the USA.