A spokesman for the governor of Katsina state said 344 had been freed and were all in a good condition.
However, other reports suggest some remain in the hands of their captors.
The attack was claimed by the Islamist militant group Boko Haram, which hours earlier released a video apparently showing some of the boys.
In his statement, the spokesman, Abdul Labaran, said the boys were being taken to the regional capital Katsina City, and would soon be reunited with their families.
He said the clip released by Boko Haram was authentic, but a message seemingly from the group's leader Abubakar Shekau was, instead, by an impersonator.
The authorities have previously given a lower figure than locals for the number abducted and it is unclear if all are now safe.
The state Governor Aminu Bello Masari was quoted by Reuters news agency as saying, "we have recovered most of the boys. It's not all of them," while a security source told the AFP news agency some remained with their captors.
Mr Labaran said none of the kidnapped boys had been killed, contradicting a boy shown in the video who said some had been killed by Nigerian fighter jets.
It is unclear how the boys' release came about but the news was confirmed to BBC Hausa by another state government official.
What happened during the attack?
Witnesses said armed men came to the school in Kankara town on Friday evening last week, and many students jumped the school fence and fled when they heard gunshots.
Others were tracked by the gunmen, who tricked them into believing that they were security personnel, students who escaped said. Once the students were rounded up, they were marched into the nearby forest by the armed men.
Students left their footwear behind in the scramble that followed the attack