"I managed to get a wee break. I knew I needed a break there to hold Dirk off. He was amazingly strong today and all I could do was sit on and wait for my opportunity on that final lap," Cooper said.
"I fell about 25 seconds before the finish which got the heart-rate going. It was pretty nerve-wracking but I managed to get up and hold on.
" If he had got in front then he would have won.
"It is such a great feeling to win the national jersey.
"It means I will be able to wear it overseas at the World Cups and that is of huge importance to me and I will wear it with great pride."
The race attracted a large number of spectators, with the championships part of the inaugural Rotorua Bike Festival.
"It was a great race for the spectators and Dirk on his home track had a lot of support. It felt like a World Cup round, it was amazing," Cooper said.
Peters, who will head to Europe again this year, is buoyed by his strong form on last week's mountain bike cup and the national championships.
"I knew it was going to be pretty close. I think he probably had the edge on me but with the hometown advantage I got lifted that extra couple of per cent and nearly got there.
"I kept throwing in attack after attack but couldn't drop him and he got ahead before the final downhill. It was so narrow I couldn't get past when he crashed and it came down to that last sprint."
Peters said racing Cooper provides an international benchmark.
"It is good to have a yard stick with Anton. We know he is world class so if we can match ourselves against him.
"It gives me a good indication of where I am at compared with other riders overseas and good for my confidence to know that I can be competitive in Europe hopefully."
Hanlen, the remarkable Whakatane mother of two, fell behind Queenstown's Kate Fluker after her fall on lap two.
However, the Olympian then turned it up a notch, to reclaim the lead and push clear, winning in 1h 34m 26s for the six laps, with Fluker second nearly three minutes behind.
Wellington's Samara Sheppard, in her first year in the elite category, was third a further three minutes back.
"I am really pleased. It is a special privilege to win the national title. I had to work hard for it."
It was also a special day for former national champion and Commonwealth Games representative Mike Northcott (Tokoroa) who finished fifth overall before announcing his retirement from elite racing after 16 years at the top level. Rotorua's Amber Johnson and Te Awamutu's Sam Gaze both produced outstanding efforts to win the under-19 titles.