“When I was 18, I saw ‘She’s Gotta Have It,’ ” Mr. Singleton said, referring to Mr. Lee’s 1986 breakthrough film, in a YouTube video in 2013. “The movie was so powerful to me, as a young black teen who grew up seeing movies with not a lot of people who looked like me.”

He was 22 when he began shooting “Boyz,” which follows Tre (played by Cuba Gooding Jr.) and his friends Ricky (Morris Chestnut) and Doughboy (Ice Cube) as they try to avoid gangs and drugs. When Ricky is shot and killed by a gang member, Doughboy, his half brother, seeks revenge, but Tre backs away from retribution.

[Read the John Singleton obituary and an appraisal of his work. | See where to stream his best films.]

Mr. Singleton had graduated from film school less than a year earlier. He later conceded that when he made “Boyz N the Hood” he did not yet know how to direct a film.

“As the movie was going along, I was learning how to direct,” he said after a 25th-anniversary screening of the film in Manhattan in 2016. “As it becomes more intense and comes on to the third act, the camerawork is more and more fluid, because I’m getting better and better — and taking more chances.”