US actress Anne Hathaway has urged white people to ask "how 'decent' are we really?" after a black teenager was stabbed to death on a California train.

Nia Wilson, 18, was killed after she and her sister were both knifed in the neck on Sunday night in Oakland.

"She was a black woman and she was murdered in cold blood by a white man," Hathaway wrote on Instagram.

The suspect, John Lee Cowell, is in custody, but officials say it is unclear if race played a factor.

Hathaway's post continued: "White people - including me, including you - must take into the marrow of our privileged bones the truth that ALL black people fear for their lives DAILY in America and have done so for GENERATIONS."

"We must ask our (white)selves - how "decent" are we really?" she added. "Not in our intent, but in our actions? In our lack of action?"

The comments were posted alongside an image of Ms Wilson, who was returning home from a family event when she was attacked.

"It basically happened at the snap of the fingers, at the drop of the pin," police chief Carlos Rojas said at a news conference on Monday.

He added that it was "the most vicious" attack he had seen in his nearly 30-year career.

"It's more reminiscent of a prison yard assault," Chief Rojas said. "They do their attack so quickly that before anybody can really react, the person takes off running."

The suspect was arrested on Monday night on board another train after an anonymous tipster called police.

In a statement on Monday, Oakland Mayor Libby Schaaf raised the subject of race in response to the killing.

She said that although the attacker's motivation is not yet known, "the fact that his victims were both young African-American women stirs deep pain and palpable fear in all of us who acknowledge the reality that our country still suffers from a tragic and deeply racist history".