At the 2017 European Athletics Indoor Championships in Belgrade on 4–5 March, his first international competition of the year, Mayer won the gold medal in the men's heptathlon with a new European record (6479 points), beating Jorge Ureña (silver, 6227 points) and Adam Helcelet (bronze, 6110 points). He achieved three indoor personal bests (in the long jump, 60m hurdles, and the pole vault) and finished third or best in six out of seven events (except the 1000m, where he finished fourth) and established personal indoor records in five (all but the shot put and the 1000m). This score is also the second-best personal record score for a men's indoor heptathlon (behind Ashton Eaton's world record of 6645 points); Mayer beat the previous European indoor record, set by Roman Šebrle at the 2004 IAAF World Indoor Championships in Budapest, by 41 points.