From The Phrase Finder:
“For those of us of a certain age the word ‘brand’ turns our thoughts to Hollywood B-feature movies and images of cowboys branding cattle on the open range. That’s not the origin of this phrase, but it’s not a million miles away in terms of meaning.
A hot burned wooden stake has been called a ‘brand’ since at least 950 AD. ‘To brand’ means to ‘make an indelible mark of ownership’, especially with a hot stake or iron. This verb usage has been known since the Middle Ages and is clearly derived from the earlier name (we might say brand name – but we’ll come to that later).
The earliest citation of ‘brand new’ is in John Foxe’s Sermons, 1570:
“New bodies, new minds and all thinges new, brande-newe.”
Terms that are old often come to us with a variety of spellings. In this case there are many variants, notable ‘bran new’, for example:
John Gay’s, The What d’ye call it? – a farce, 1714: “Wear these Breeches Tom; they’re quite bran-new.”
The Times from 1788: “The liquor fpoiled a bran new pair of fattin breaches.”
[Note that The Times persisted in printing the long form of ‘s’ characters (which resemble the letter ‘f’ with a short cross-bar) as late as 1788. This form had been commonplace in printed material until about 1780, when it went into a sudden decline.]
Other spellings include ‘brent’ and ‘brank’:
Burns, Tam o’ Shanter, 1790: “Nae cotillon brent new frae France.”
Scott, St. Ronan’s, 1824: “Yeomen with the brank new blues and buckskins.”
These spellings aren’t, of course, different words but simply alternative pronunciations of ‘brand’.
Not just ‘new’, not just ‘brand new’, but ‘brand spanking new’,
It is sometimes put about that ‘brand new’ comes from marketing jargon, where terms like ‘brand loyalty’ etc. are commonplace. That’s about a thousand years too late as the origin, but again, it does have the same meaning as the early form. A ‘brand’ in marketing terms comes from the meaning of the word as ‘a particular class of goods, as indicated by a trade mark’.
So, that’s ‘brand new’; what about the double form ‘brand spanking new’? Spanking is little more than an intensifier in this phrase. The word does have a distinct meaning, unrelated to ‘slapping with the hand’, which is ‘exceptionally large or fine’; for example, Fanshawe’s Love for Love’s sake, 1666:
“What a spanking Labradora!”
As with the spellings there are variants of the intensified form – ‘brand span new’, ‘spick and span new‘, etc. These citations pre-date any known version of ‘brand spanking new’:
Henry Angelo’s Reminiscences, 1830: “His feet were thrust into a bran-span new pair of fashionable pumps.”
The Whitby Glossary, 1855: “Brandnew, Brandspandernew, fresh from the maker’s hands, or ‘spic and span new’.”
It appears that whoever coined ‘brand spanking new’ did so by appropriating the imagery of ‘spick and span‘, the rhyming of ‘bran’ and ‘span’ and the meaning of ‘spanking’ to produce a satisfying-sounding phrase with some appropriate associations. Whatever the intent of the early users of the phrase it is, in Eric Partridge’s meaning of the term, a catchphrase, that is, it has caught on. It appears to have been coined around the turn of the 20th century and is still in common use. The earliest printed citation I can find is in a story about a luckless sea captain, in Harper’s New Monthly Magazine, April 1860, titled Captain Tom: A Resurrection:
He had a new vessel, he had a new crew, he had brand spanking new fish-gear; but he had his old luck.