A group of 27 Year 8 pupils at Corpus Christi Catholic College in Leeds competed over five days in the Four Nations Maths Challenge, which is open to all schools in England, Scotland, Wales and Northern Ireland.
Pupils had to solve real-time online minute-long mental challenges.
They also tested and improved their knowledge by engaging in longer tests, both at home and in school.
The Corpus Christi pupils gained the highest total school points to clinch the title.
Two pupils, James Bannister and James Weaver, each accrued over 30,000 points to finish in the top 70 out of 77,854 students who took part.
A total of 1,686 schools participated in the maths competition, answering almost 37 million questions throughout the week.
Headteacher Mike Woods said: "This is a great achievement for the pupils and for Corpus Christi. To be the top school throughout the UK is fantastic and shows that our pupils are indeed some of the best in the country."