Five men were killed in all, police said, but a woman who had been hiding inside the suburban home through much of the 11-hour ordeal survived.
Randal Simmons, 51, was the first SWAT officer killed in the line of duty in the unit's 41-year-history, officials said.
"This is a very horrible tragedy and our hearts go out to all the members of the LAPD who also are grieving at this time," said Mayor Antonio Villaraigosa, who said he visited with Simmons' family.
The standoff began Wednesday night after a SWAT team responded to the 911 call and surrounded the San Fernando Valley house. About three hours later, officers entered the one-story home and got into a gunfight with the suspect. Two officers were shot, and police retreated with their wounded colleagues.
Both officers were taken to Northridge Medical Center, where Simmons, 51, died just after 1 a.m., said Assistant Chief Jim McDonnell. The other, 51-year-old James Veenstra, had undergone surgery and was expected to survive.
During the shootout, officers found three men - two that appeared dead and a third that appeared to be alive. The third man was taken out of the house, but was pronounced dead at the scene.
Authorities tried to reach the gunman by telephone and by loudspeaker, and family members asked the man to give himself up.
"Unfortunately the suspect had absolutely no contact with us, made no effort to surrender," said Assistant Chief Michael Moore.
Police eventually lobbed tear gas into the home and hit it repeatedly with a battering ram.
Around that time, a woman ran from the rear of the house and was rescued. Police said she had been hiding in the home during the ordeal. Her name and possible relationship to the gunman were not released.
The house eventually caught fire, although authorities said they were not sure if it was caused by a flash-bang device or if the gunman ignited it.
The gunman, who was not identified, later died in another exchange of gunfire, Moore said.
Police did not identify the three men, but Moore said they might have been related to one another or to the family that lived in the house.
"When you look at the amount of shots fired and the threat to this community, we're very thankful SWAT intervened," McDonnell said. "It could have been much worse."
Mayor Antonio Villaraigosa was at the news conference and said he had visited with the family of the officer who was killed.
"This is a very horrible tragedy and our hearts go out to all the members of the LAPD who also are grieving at this time," Villaraigosa said.
Both SWAT team members who were shot have spent more than 25 years in the Los Angeles Police Department, reports KCBS.
Mayor Antonio Villaraigosa said he had visited with the family of Simmons, who left a wife and two teenage children. Veenstra's wife is a captain on the force.