"I can confirm that there were three shooting victims. We have confirmed that two are deceased, one is in stable condition in a local hospital," said Rear Admiral Robert Chadwick.
He added that the shooter -- "tentatively" identified as a sailor assigned to the USS Columbia, a Los Angeles-class attack submarine -- had also died after "an apparent self-inflicted gunshot wound."
One witness told local media he was sitting at his computer when he heard shots fired and rushed to the window, where he saw three victims on the ground.
The witness, who did not want to be identified, said he then saw the gunman, who was wearing a sailor's uniform, shoot himself in the head.
White House spokesman Hogan Gidley said that US President Donald Trump had been briefed on the shooting and was monitoring the situation.
Hawaii governor David Ige tweeted that the "White House has reached out to offer assistance from federal agencies, and the state is standing by to assist where necessary."
"I join in solidarity with the people of Hawaii as we express our heartbreak over this tragedy and concern for those affected by the shooting," Ige wrote.
Pearl Harbor anniversary
The shooting took place at 2:30 pm local time near the south entrance of the sprawling base located on the southern shore of Oahu.
The base hosts both the Navy and Air Force.
It unfolded three days before the 78th anniversary of the 1941 Japanese surprise attack on Pearl Harbor that left more than 2,400 US service members dead.
The worst shooting in Hawaii history took place just over 20 years ago when a Xerox employee killed seven of his colleagues.
While gun violence is common in the United States, shootings at American military facilities in the country are relatively rare.
In July 2015, Mohammad Youssuf Abdulazeez carried out an attack at two military installations in the US state of Tennessee that killed four Marines and a sailor, with the FBI concluding that the violence was inspired by a "foreign terrorist group."
Two years earlier, Aaron Alexis killed 12 people and wounded eight others at the Washington Navy Yard, just two miles (three kilometers) from the US Capitol building, before being shot dead by officers.
Four years before that, Major Nidal Hasan, a US Army psychiatrist, killed 13 people and wounded more than 30 others at Fort Hood.
He was considered a "lone wolf" who supported terror network Al-Qaeda.
In 2016, the Pentagon softened rules on US troops carrying firearms while at government facilities in response to a series of deadly attacks on uniformed personnel.
Troops already carried weapons as part of certain job functions, but the new rules permitted commanders to authorize the carrying of privately owned handguns. —AFP