Carter, who was sworn in on Tuesday, plans to bring in a civilian to replace Kirby, a uniformed military officer, officials said.
"We all serve at the pleasure of the secretary," Kirby told reporters Wednesday at the Pentagon. “I've been honored to have the opportunity. It's really been a real privilege and I've enjoyed almost every day of it.”
Carter did not name a new spokesperson. Kirby said he will stay several weeks to assist with the transition.
It is not unusual for new defense chiefs to hire civilians to speak for them, or to bring in other senior staff. Carter has tapped Eric Fanning, an undersecretary of the Air Force, for his chief of staff and Army Maj. Gen. Ron Lewis as his top military advisor.
But Kirby’s ouster came as a surprise because he was widely respected for his ability to articulate Obama administration policy and to reflect the Pentagon's views on a range of military matters. He appears on CNN regularly to discuss news of the day.
A Navy officer since 1986, Kirby previously served as spokesman for former Joint Chiefs Chairman Adm. Michael Mullen and later was chief of public affairs at the Navy.
Carter's predecessor, Chuck Hagel, brought Kirby in as top Pentagon spokesman in December 2013.
Kirby said Wednesday that he has generally felt comfortable explaining policy decisions over the last year.
“I can’t … say that there haven't been some questions that obviously have tried to veer me into political discussions,” he said. “I knew that when I took this job that that was a potential. But they've been few and very, very far between.”
Pentagon reporters applauded Kirby when he announced his departure. He did not disclose his plans after he leaves.
Follow @wjhenn for military and defense info.