The ambush, which took place on Saturday in north-eastern Borno state, led to a clash in which one soldier and at least five militants were killed.
Army chief Gen Tukur Buratai took up his post in July after the president sacked the heads of the military for failing to end Boko Haram’s insurgency.
Boko Haram began fighting for an Islamic state in the north in 2009.
At least 17,000 people have been killed since then, according to Amnesty International.
Gen Buratai was visiting troops in Borno state when his convoy was ambushed about 45km (28 miles) east of the state capital, Maiduguri, an army spokesman said.
Nigeria’s Premium Times reported that an advance section of the convoy had been targeted, and that Gen Buratai had later ordered the convoy to stop so that suspects could be arrested.
Boko Haram has lost territory in recent months to a multinational force that includes troops from Nigeria’s neighbours. But the militant group has stepped up its campaign since President Muhammadu Buhari took office in May.
Mr Buhari, a former army general, has given his new military chiefs a three-month deadline to defeat Boko Haram.
News of the ambush in Borno emerged yesterday as UN Secretary-General Ban Ki-moon was due to arrive to mark the fourth anniversary of a Boko Haram attack on the UN building in the capital, Abuja.