Navy security forces then killed the suspect, who was authorized to be at Naval Station Norfolk and did not bring his own weapon on base, according to the Navy's statement. No other fatalities or injuries were reported.
The male sailor was shot about 11:20 p.m. on the USS Mahan, a guided-missile destroyer, base spokeswoman Terri Davis said Tuesday. She said she couldn't say whether the suspect had permission to be onboard.
The base was briefly on lockdown. Davis would not describe any other circumstances of the shooting but said the scene was secure as of early Tuesday.
The Navy will release both men's names once their families are notified, Davis said.
Aside from the pier where the Mahan was docked, operations had returned to normal at the base, with counselors available, the Navy said in a statement. But most enlisted sailors on the Mahan - docked at the first of 13 main piers - were not to report to duty Tuesday. Base traffic was typical Tuesday morning.
Some sailors gathered for a training session - unrelated to the shooting - and began with a moment of silence for their colleague. "We'll find out what happened, and we'll prevent that from occurring again," Adm. Bill Gortney, commander of U.S. Fleet Forces Command, based in Norfolk, told them.
The shooting on the Mahan comes about a month after the Navy held anti-terrorism and force protection exercises on bases around the U.S., including an active-shooter drill at the Norfolk station.
To get on the base, civilians must be escorted or have identification that allows them to be there. Authorized civilians can include Department of Defense employees, contractors and military family members. Davis would not elaborate on how the suspect was authorized to get on base.
Each base entrance is guarded, and motorists present IDs. Inspections are rare. All 13 piers have additional security forces. As part of ongoing security efforts, handheld ID scanners were implemented this year at Navy bases in the region, including the Norfolk station.
The shooting comes months after a September incident at the Washington Navy Yard, in which a gunman - identified as a contractor and former Navy reservist - killed 12 civilian workers before being shot to death.
The Norfolk base covers more than 6,000 acres and is the home port for 64 ships, according to information the Navy provided in February. About 46,000 military members and 21,000 civilian government employees and contractors are assigned to the base and its ships, according to the Navy figures.
The base also is the home port for a Navy hospital ship, docked at Pier 1 with the Mahan.
In February, the Norfolk base got a new commanding officer, Capt. Robert E. Clark Jr. He took over for Capt. David A. Culler Jr., who was set to retire in May. Clark had served as the installation's executive officer since 2012.
The Mahan, commissioned in 1998, has a crew of nearly 300. In September, it returned to Norfolk after a deployment of more than eight months that included being positioned in the eastern Mediterranean Sea for a potential strike against Syria.
Associated Press writer Bernard McGhee in Atlanta contributed to this report.