Two years after his 24-year-old girlfriend was shot and killed on live television, a Virginia Democrat on Tuesday defeated an opponent who was endorsed by the National Rifle Association for a seat in the State Legislature.

Chris Hurst, a former news anchor whose girlfriend and colleague, Alison Parker, was killed on air in 2015, overtook Joseph Yost to win the 12th House District seat in the state’s Legislature. He will be one of two Democrats to represent the state’s deeply conservative southwest region in the House.

In an interview Wednesday morning, Mr. Hurst, 30, described himself as humbled and awe-struck by his victory. He said that before Ms. Parker’s death, he had not had political aspirations.

“Our campaign has really tried not to focus on what happened to me,” he said. “Only inasmuch as I needed to explain to voters why I was running and leaving a good-paying job and a career that I loved.”