Capt. Khalid Sawarmy said the rebels were killed during fighting on Friday night, when army forces attacked joint positions of two rebel groups — the Justice and Equality Movement and the Sudan Liberation Movement.
Three soldiers also died and 13 were wounded in the fighting, Sawarmy said, according to the official Sudan News Agency.
He said a senior rebel from the JEM, identified as Mohamed Osman Janjaweed, was among the 40 killed.
Darfur has been in turmoil since 2003, when ethnic African rebels took up arms against the Arab-dominated government, accusing it of discrimination and neglect of their region. The U.N. says some 300,000 people died 2.7 million fled their homes because of the conflict.
Khartoum maintains that an alliance of the two rebel groups is based in southern Sudan, from where its fighters entered southern Darfur in the latest attack on government troops.
The Darfur conflict is separate from the troubled southern Sudan, where a civil war raged over 20 years and where a 2005 peace deal called for a referendum on the future of the south. That vote is to be held in January and is likely to see Sudan, Africa's largest country, split in two.