There is a story they tell at Midtjylland, the small Danish club that went from close to bankruptcy to lifting their first Superliga title in one exhilarating headrush of a season, which has echoes of Hans Christian Andersen. Two centuries ago there were wolves on the Jutland peninsula, which is why there is a red wolf on the club’s badge. They had long died out in Denmark but two years ago they suddenly appeared again. “We took it as a sign that the wolves could rise up,” says the club’s brand manager, Soren Marcher. “And now we have.”

This season Midtjylland aim to prowl into the heart of Europe. On Tuesday night they play the first leg of a Champions League third qualifying round tie against Apoel of Cyprus, having defeated Lincoln Red Imps of Gibraltar 3-0 on aggregate in their first taste of the competition. Come through that, and a final two-leg match on the early-season trans‑Europe express, and they will be in the Champions League proper for the first time. “We would love to get to the group stages,” the majority shareholder, Matthew Benham, admits. “We know it is a tall order but we’ll give it our best shot.”

Midtjylland are not yet on the radar of most English football fans, but Benham increasingly is. The 47-year‑old Brentford owner made millions at his company, Smartodds, using mathematical models to predict football results and believes the figures can also provide a vital edge in the transfer market and on the pitch. Brentford’s former management team, Mark Warburton and David Weir, did not buy into that theory. Midtjylland, however, were more amenable – and, arguably, successful.

Matthew Benham, left, took a controlling interest in FC Midtjylland in July 2014. Photograph: Søren Palmelund for the Guardian

The club’s chairman, Rasmus Ankersen, describes what has happened since Benham invested £6.2m last July as “a fairytale”. But the introduction of specialist kicking coaches, in-game statistics for half-time team talks and the use of analytics for set pieces is Midtjylland’s new reality. As their Denmark defender Erik Sviatchenko puts it: “Matthew is the x-factor. His money is hugely important. But his use of statistics and mathematics is the extra thing that gives us the advantage. It is like Moneyball.”

When I watched Midtjylland effectively secure the title with a 2-0 win over FC Copenhagen in May at their packed 11,000-seat stadium the mood was pinch-yourself-giddy, especially after Pione Sisto – a brilliant 20-year-old – made the game safe with a fantastic second goal, backheeling the ball between his legs, spinning and almost inviting two opposition players to follow him out of the penalty box like a piped piper, before curling a brilliant shot into the far corner. The team were well organised in a 4-1-4-1 formation and played lots of neat one-touch football but it was also noticeable how often they went close from set pieces.

The club believe that is not down to chance. Impressively, nearly half of their goals last season came from set pieces, a strike rate that ranked up with Atlético Madrid as the best in Europe. Much of the work is done by the assistant manager Brian Priske – who played for Portsmouth under Harry Redknapp and 24 times for Denmark – who runs the club’s “set-piece lounge”, in which stats, files and video clips are scrutinised and routines devised.

Almost half of FC Midtjylland’s goals last season came from set pieces, with their assistant manager Brian Priske running a ‘set-piece lounge’ at the club. Photograph: Søren Palmelund for the Guardian

“It involves hours of hard work in the meeting rooms and on the pitch, and the use of Smartodds’ statistics as well,” explains Priske. Tim Sparv, the team’s tall Finnish defensive midfielder, says those meetings not only include key players but that Ankersen and Benham, also chip in via Skype. “One time Matthew showed us a YouTube clip of a corner from 20 years ago and wondered whether it might be revived,” he said. “It was nice to see him getting involved so much – it shows how much he wants us to succeed.”

Midtjylland also employ Bartek Sylwestrzak, a specialist kicking coach, to work with their best players from under-14 level to the first team. Twice a month he analyses how each player strikes the ball and devises training programmes that players work on in their spare time. Cynics will scoff. But if Jonny Wilkinson felt he benefited from a kicking coach is it so outlandish that footballers might do the same?

The club also use bespoke statistics to provide their coach with a more objective view of matches. After some persuasion the sports director, Claus Steinlein – a former professional footballer – lets me see the sort of text message their analytics experts send to the coaches at half-time and full-time. Amid the acronyms, two stats stand out: each team’s chances and half-chances, and the expected score based on the quality of those chances. The thinking is simple: football is a low-scoring game and so missed chances, luck, or bad refereeing decisions mean a stronger team win less often than in many sports, so such data should give coaches a more accurate assessment of how the scoreline reflects the match.

Analytical models are also central in Midtjylland’s search for new players. As Steinlein explains, the club could use the database to find any two-footed left-back in the world of a certain standard, aged 22-26, who has not been injured for the previous 18 months – while the recent addition of player-tracking data gives them a further advantage. “Before we had one scout – and he spent half his time coaching,” explains Steinlein. “Now we have a team in London crunching the numbers and suggesting suitable targets. We have gone from using our heart to using our brain.”

FC Midtjylland’s rise has been rapid since Matthew Benham invested, going from near-bankruptcy to their first Superliga title in the space of one season. Photograph: Søren Palmelund for the Guardian

This summer they have signed the Danish defender Kian Hansen, who started 28 league games for Nantes in Ligue 1 last season, and the Austria Wien winger Daniel Royer, who is also a full Austrian international, thanks to their mathematical models. They will be worth keeping a close eye on in the year ahead. “Not everything we do is perfect,” admits Steinlein. “Sometimes we find that two plus two equals five. But the computer guys have given us a new way of thinking.”

Ankersen, though, who also recently took on the role as Brentford’s director of football, admits there is a balancing act between revealing some of what they do without giving too much away. “Matthew likes to go under the radar with our secrets,” he laughs. “But at the same time we want to be known as the two most innovative clubs in Europe, because that way we can more easily attract good players and experts.”

No wonder Midtjylland, who only have the third or fourth largest budget in the Superliga, have become a poster club for analytics in football – but there is more to their success than Benham’s influence, or Smartodds, or its use of analytics. When the Englishman arrived last July much of the groundwork was in place and the club already had a highly regarded academy, one which brought through the Denmark international Simon Kjaer and West Ham’s Winston Reid. A group of talented youngsters, including Sisto – who has attracted interest from major clubs in Spain, England and Germany – were also making waves. The team were already good. They are better now.

Much of what the club do is not rocket science, however. The players get homework on DVD or a USB stick. They eat healthy diets and almost never drink or eat sweets during the season – something that sounds obvious but it is not always common. When the Brentford youth player Montell Moore joined Midtjylland on loan he asked why there were no sweets in the dressing room, as there were in London.

The fresh thinking extends to psychology. Sviatchenko, the team’s best defender, believes that using the mind coach Rene Petersen – whose time at the club predates Benham – has made a big difference. “He has helped me a lot,” he says. “As a 19-year-old I was asking myself: ‘What I am fundamentally as a defender. Am I John Terry or am I David Luiz? And when does Good Erik and Bad Erik appear?’ He helped with that.”

Petersen uses unusual methods to bring the squad together. Last year he asked the players to analyse each other using different colours. Yellow was more creative. Green someone who cares for other people’s feelings. Blue applied to structure. Red to someone who wanted to win at any price. “We had to give coloured cards to each player in the squad based on what we thought they were like,” says Sviatchenko. “It really helped because afterwards we talked about how best to speak to each player. It’s on a different level and it has helped us this year.”

However, the club were rocked to the core last month when their inspirational coach Glen Riddersholm, who had guided them to the league title, handed in his resignation after returning from holiday. Long-running tensions with Steinlein, rather than any beef with Benham, were rumoured to be the reason. The club have selected Jess Thorup, Denmark’s highly regarded Under-21 coach, as his replacement, but Troels Bager Thogersen, the editor-in-chief of the Danish football magazine Tipsbladet, points out that some of the wounds are still raw.

“Riddersholm had been with the club for four years and was well liked by the players,” he says. “They aren’t happy that he has gone. The next few weeks will be a crucial test for Benham and Ankersen because the strong team chemistry helped win them their first title ahead of schedule.”

Ankersen is confident, though, that there is a more improvement to come from not only Midtjylland’s players, but also his backroom team of analytics wizards. “Football is very conservative, which means there are a lot of inefficiencies we can exploit,” he says. “And we have only just started the journey.”