Mashele, the defending trials champion, and Mokoka, who won the national championships in George in September, opened a gap on the rest of the field in the early stages before Mashele drew clear.
Holding a 50-metre lead as he set out for the last of six laps, Mashele was grimacing and looked to be in trouble with Mokoka reeling him in, but he showed tremendous determination to hold on in a sprint finish, winning by one second in 38:04.
"There were a lot of bumps and hills so I struggled over the last two laps, but my strategy was to open a big gap and it worked," Mashele said.
Mokoka, celebrating his 30th birthday, was full of praise for his 24-year-old Gauteng North teammate.
"I was not as strong as he is at his age, and 12km is probably still a bit long for him, so he's got a bright future," Mokoka said.
"The course was tough and I'm still a bit rusty at this stage of the season, but it was a good race."
Perhaps the most impressive performance of the day, however, belonged to 41-year-old Shadrack Hoff, who displayed his class by taking fifth position, just 42 seconds off the pace.
Hoff, who set the SA 5 000m record 19 years ago (his 13:14.16 still stands) could be selected for the national team to the World Cross Country Championships in Guiyang, China, in March.
Meanwhile, Nolene Conrad had no trouble in the senior women's 8km race, charging clear to win comfortably in 28:57.
Algerian athlete Amina Bettiche took second place in 29:09, while 19-year-old Annie Bothma surprised everyone, including herself, as the second South African home (and third overall) in her first race as a senior athlete.
Pre-race favourite Lebo Phalula was dropped on the second of four laps, after trying to challenge Conrad in the early stages, and settled for fourth position.
"I was going for first place but it was a bit unexpected because I know Lebo is very fit," Conrad said.
"I was hoping for a fast race because I'm running my second (career) marathon in April, and I felt good after two kilometres, so I decided to go for it and nobody responded."
Athletics SA cross country chairman Jakes Jacobs confirmed the national team for the global championships would be announced in the second week of February.
Jacobs said the federation was likely to select six athletes in the senior men's and women's divisions, and four athletes in the junior categories.
Source: Sapa