DUN DUN DUN. “Oh baby, baby ... ”. In just three seconds ...Baby One More Time, which turns 20 this year, announced the arrival of a new superstar: the then 16-year-old ex-Mouseketeer from Kentwood, Louisiana, Britney Jean Spears. Along with its equally iconic high school-set music video it re-turfed pop, kickstarting an entire sound (think funk-tinged R&B grooves mixed with Abba melodies), sweeping aside the dregs of grunge (sorry, Bush) and US heartland rock (bye, Hootie & the Blowfish), revitalising pop radio and MTV in the process, before cementing its songwriter and co-producer Max Martin as one of modern music’s most influential exponents. In the space of just three minutes and 31 seconds, Spears launched millennial teen pop, fusing family-friendly, girl-next-door fun with good old fashioned controversy, forging a template for those who followed.

Without it, there would by no Christina Aguilera, no Katy Perry, no Charli XCX; Taylor Swift would probably still be singing country songs, and Eminem – who arrived in 1999 – would not have had as much to rail against. Released in the wake of Alanis Morissette’s hugely successful 1995 album Jagged Little Pill and its litany of imitators, it presented a different angle to the prevalent idea of female angst; this was gloriously OTT teen girl longing, encapsulated by a lyric – “My loneliness is killing me” – that feels depressingly evergreen. “The whole song is about that stress that we all go through as teens,” Spears tells me. “I knew it was a great song. It was different and I loved it, [but] I don’t think you can anticipate how a song is going to be received.”

In a Sliding Doors-esque moment that could have changed the world as we know it, …Baby One More Time very nearly didn’t get written at all, with the song’s melody bubbling up as Martin was drifting off to sleep. Having hauled himself out of bed to his nearby dictaphone, he sketched out the song. “I remember listening back to [the tape] after [the song] blew up and you can hear me sort of go: ‘Hit me baby one more time’, then I hear myself say, Yeah, it’s pretty good,’” the notoriously interview-shy Martin told Swedish journalist Jan Gradvall in 2016. Martin, convinced he’d written an R&B song (“Pop music with a flavour – what we call R&B in Sweden, what you guys [in America] say is pop,” he said in 1998), sent the song, then called Hit Me Baby (One More Time), to TLC who rejected it. “I was like: ‘I like the song but do I think it’s a hit? Do I think it’s TLC?’ … Was I going to say ‘Hit me baby one more time’? Hell no!” said T-Boz in 2013.

While TLC interpreted the lyrics as alluding to domestic violence, they actually represented Martin’s attempts at American slang, believing “hit me” could seamlessly replace “call me”. The song was then offered to fellow Swede, Robyn, whom Martin had already worked with on two US top 10 singles (Do You Know (What It Takes) and Show Me Love, both released in 1997), but again nothing came of it. According to Tim Bower’s 2012 book, Sweet Revenge: The Intimate Life of Simon Cowell, the song had one further dalliance with a pop act other than Britney. The story goes that after hearing Martin’s demo of what had now been renamed …Baby One More Time, Cowell demanded he have the song for his latest boyband, UK rabble Five. Martin had already co-written Five’s debut single, Slam Dunk (Da Funk) alongside his mentor, the late Denniz Pop, but declined Cowell’s request, saying it had already been earmarked for Spears. “You’re mad,” Cowell is reported to have said. “No one can be successful with a name like that.” As a last gasp attempt, Cowell offered Martin a new Merc 500SL in return for the song. “It costs £95,000,” he added.

It was …Baby One More Time that convinced Spears of the merits of pop. She initially saw herself as making “Sheryl Crow music, but younger”, while Larry Rudolph, an entertainment lawyer friend of Spears’s mum Lynne who had been tasked with getting her signed (he’s now her manager), had her record a clutch of songs originally recorded by Toni Braxton. It was those recordings that lead to auditions for Mercury, Epic and Jive (the first two labels said no; she signed with the latter) which included Spears covering Whitney Houston’s version of I Will Always Love You. With the more R&B-leaning early material not working, and with a clause allowing Jive to terminate her contract after 90 days if they felt an album wasn’t on the horizon, A&R Steve Lunt approached Martin, who had already delivered success for Jive’s boyband the Backstreet Boys. A meeting was set up with Spears in New York. “I was pretty young at the time, so I was nervous,” she says, “but he was so nice and put me right at ease.” For Martin, his song had finally found its home.

Facebook Twitter Pinterest Maxed out: Spears and Martin, 2017. Photograph: Lester Cohen/WireImage

From New York, Spears de-camped to Martin’s Cheiron studios in Stockholm to start recording. “I remember being so in awe of Stockholm,” Spears says. “I was out there for, like, 10 days, but we were so busy in the studio I didn’t have time to go out and explore on that first trip.” The song’s co-producer Rami Yacoub remembers Spears as “very shy and super sweet – I mean she was a kid and we had no idea there was a beast of an artist lurking under that innocent look”. The sessions were intense, with four of the album’s five singles recorded in that time. In 2001, Martin referred to the Cheiron sound as “direct, effective, we don’t show off”, words reiterated by Yacoub. “A song that sounds simple is not simple to make. It’s all about the taste and making sure you don’t add more than what the song needs.”

For Spears, working with perfectionists suited her. “I really respect that when I’m working with him,” she says. “I think Max is a genius. It all just came together and felt right. In my opinion Max is the greatest songwriter of all time.”

Another person to witness firsthand this studied effortlessness was Nana Hedin, a backing vocalist who had previously worked with Denniz Pop on songs by Dr Alban, whose 1992 hit It’s My Life soundtracked a Tampax advert in the UK. Pop recommended Hedin to Martin, who brought her onboard for …Baby One More Time. “I remember I thought the song was for teenagers but the production was filled with a grown-up attitude and sounds that I really liked,” she says. “I was so impressed by how a guy like Max could write lyrics that got into the hearts and spoke to the teenage thinking.” Occasionally, Hedin would record her backing vocals first, before the artist arrived, but with …Baby One More Time Spears’s vocals were already recorded. “I tried to sound exactly like her,” she laughs. “It was hard, but a lot of fun. I’m like a parrot in many ways. I try to get the same vibe and use the exact same pronunciation as the artist. In one harmony, each take is different; I sing very high, in another I use powerful belting, the next I’m whispering and sometimes I even pinch my nose for a sharper sound.”

With Britney’s vocals recorded in March, and the song finished shortly after (“It took probably around two to three weeks to finish,” says Yacoub), Spears headed out on a summer tour, taking in 26 shopping malls. Aware that they had a potential hit on their hands, Jive sent reps out to meet with the influential US radio programme directors ahead of the song’s October release. “The label guy brought in a video featuring Britney rehearsing dance moves to the song,” remembers Clarke Ingram, then operations manager and program director of New York’s Top 40 radio station WPXY. “This had the desired effect of showing me that Britney had star quality, in addition to having a potential hit record. We went to lunch afterwards, and I committed to adding the song at that time.” In fact, Ingram is pretty sure he was the first person to play the song on US radio. “No other station would have heard it any earlier, and I know of no station that played it before we did.” For Ingram, …Baby One More Time represented the holy grail: a song pop radio could fully own. “We’d been through an alternative cycle in the early to mid-90s, and something of an R&B cycle after that,” he explains. “Britney was among the first big artists in a pop cycle that began in the late 1990s and continued into the early 2000s. The song hit the centre of the Top 40 audience, and it proved that by its performance, both on the air and off.”

Facebook Twitter Pinterest She’s so lucky: Britney in 1999. Photograph: ACTION PRESS/REX/Shutterstock

The song sold 500,000 copies on its first day of release in the US, eventually peaking at No 1. It reached No 1 in every single country it charted in, and was 1999’s biggest-selling song in the UK with 1.4m copies sold. A megastar had been created seemingly overnight. “I don’t think we understood what we had done,” Martin said in a 2008 Swedish radio documentary. “I remember sitting in the studio when they called me to let me know that my song had made No 1 in the USA … I had so much going on I didn’t really grasp the meaning of it”. He even forgot to tell Yacoub. “Max walked into the studio one day while I was working and said: ‘Hey man, by the way, we are No 1 in America,’” he recalls. “I asked him when it had happened and he said: ‘Three weeks ago.’ We really didn’t focus on charts, we just kept working.” Even celebrations were muted. “It was on a Tuesday, I believe: an early dinner, a cigar, and to bed at 11pm as we had work the next day.”

An iconic song needed an iconic video. Unfortunately, director Nigel Dick’s original concept was deemed a dud by Spears. “I wrote an idea which sucked, so the label put me back on the phone with Britney who told me she wanted to make a video where she was stuck in a classroom thinking about boys and we took it from there,” Dick writes on the harangued-sounding FAQ section of his website. He also states the school uniform look, augmented by plaited bunches and bare midriff, was Spears’s idea too. What seems relatively tame now caused uproar in a bubblegum pop era that, via shows like MTV’s popular Total Request Live, was being fed directly into family homes.

The video, an instant pop culture moment that gave Spears all-important tabloid notoriety, also fused in the public consciousness with David LaChapelle’s controversial 1999 Rolling Stone cover shoot featuring Spears lying on her childhood bed in her underwear clutching a Teletubby. Suddenly, the now turbo-charged teen pop genre had its flag bearer, one whose identity – sweet southern belle in the video for soft-focus follow-up single Sometimes; red PVC-clad dominatrix in the “not that innocent” Oops!…I Did It Again visual – was malleable enough to, at least initially, be everything all at once. How does Spears feel about the song almost 20 years later? “Wow, that went quick. It was such a fun and crazy time, it was a bit of a blur.”

Britney Spears plays Open Air Theatre, Scarborough, Friday 17 August; touring to 1 September