The last ship refuelled by the Japanese support mission was a Pakistani navy destroyer, Japan's Kyodo News agency reported.
As they carried out the final operation about 70 crew members from the supply ship Tokiwa appeared on deck, cheering and singing the Japanese national anthem, Kyodo said.
Japan is the top US ally in Asia and has refuelled coalition warships in support of US-led forces in Afghanistan since 2001.
Washington has been urging the Japanese government to extend the mission.
Yusuo Fukuda, the prime minister appointed last month, has said getting an extension to the mission through parliament is a top priority, but he faces strong opposition.
Japan's so-called pacifist constitution forbids its armed forces from carrying out anything but defensive missions, but the government has been trying to revise legislation allowing for a more active defence policy.