After an hours-long search, police said the suspect killed himself.
Some area schools went into lockdowns, Metropolitan Police Department Chief Robert Contee said.
Contee said the identity of the suspect could not be released until family was notified.
But earlier had said they were seeking a 23-year-old Virginia man as a person of interest in the shooting.
According to Contee, investigators believe a video posted online from the shooter's perspective was filmed during the shooting.
He said police found a tripod setup inside the apartment where the suspect was found.
The nation's capital had more than 220 murders in 2021, according to police statistics.
Cristiano Ronaldo Announces Death of Son