Dick Gregory, the US comedian and civil rights activist who used humour to break down racial barriers, has died aged 84.

The comic passed away late on Saturday in Washington after spending a week in hospital fighting a bacterial infection, his son Christian said.

"It is with enormous sadness that the Gregory family confirms that their father, comedic legend and civil rights activist Mr Dick Gregory departed this earth tonight," he wrote on Instagram.

One of the first black stand-up comedians to find success with white audiences in the early 1960s, Gregory rose from an impoverished childhood in St Louis to win a college track scholarship and become a celebrated satirist who deftly commented upon racial divisions at the dawn of the civil rights movement.

He paved the way for, and heavily influenced, comedians such as Eddie Murphy and Richard Pryor.

Gregory began his career on the stage by winning talent contests for his comedic routines, which he continued to perform while in the army. After he was discharged in 1956, he struggled to break into the stand-up circuit in Chicago, working odd jobs as a postal clerk and car washer to survive.

His breakthrough came in 1961, when he was asked to fill in for another comedian at Chicago's Playboy Club. His audience, mostly white Southern businessmen, heckled him with racist jibes, but he stuck it out for hours and left them laughing.

The job was supposed to be a one-night gig, but lasted two months – and landed him a profile in Time magazine and a spot on US late-night talk show The Tonight Show.

"Where else in the world but America," he joked, "could I have lived in the worst neighbourhoods, attended the worst schools, rode in the back of the bus, and get paid $5,000 a week just for talking about it?"

Influential: Gregory inspired Richard Pryor and Eddie Murphy (Michael Ochs Archives)

Gregory's sharp commentary soon led him into civil rights activism, where his ability to woo audiences through humour helped bring national attention to fledgling efforts at integration and social equality for black people.

Actress and comedian Whoopi Goldberg was among those who paid tribute on social media to Gregory following his death, describing him as a "truth teller" and comedian who could "make you fall on your face laughing".

"Condolences to his family and to us who won't have his insight to lean on," she added.

Democratic Senator Cory Booker, of New Jersey, tweeted: "Dick Gregory's unflinching honesty and courage inspired us to fight, live, laugh and love despite it all."

Gregory briefly sought political office, running unsuccessfully to be mayor of Chicago in 1966 and the US President in 1968, when he got 200,000 votes as the Peace and Freedom party candidate.

In the late 1960s, he befriended John Lennon and was among the voices heard on Lennon's anti-war anthem "Give Peace a Chance," recorded in the Montreal hotel room where Lennon and Yoko Ono were staging a "bed-in" for peace.

An admirer of Gandhi and Martin Luther King Jr, Gregory rejected violence and became a vegetarian and marathon-runner.

He preached about the transformative powers of prayer and good health. Once an overweight smoker and drinker, he became a trim, energetic proponent of liquid meals and raw food diets. In the late 1980s, he developed and distributed products for the popular Slim-Safe Bahamian Diet.

When diagnosed with lymphoma in 2000, he fought it with herbs, exercise and vitamins. It later went into remission.

He took a break from performing in comedy clubs, saying the alcohol and smoke in such environments were unhealthy, and focused on lecturing and writing more than a dozen books, including an autobiography and a memoir.

On a number of occasions, Gregory went without solid foods for a week to draw attention to causes such as Middle East peace, American hostages in Iran, animal rights, police brutality, the Equal Rights Amendment for women, and to support pop singer Michael Jackson after he was charged with sexual molestation in 2004.

"We thought I was going to be a great athlete, and we were wrong, and I thought I was going to be a great entertainer, and that wasn't it either. I'm going to be an American Citizen. First class," he once said.

His political passions were never far from his mind and hurt his comedy career as the US grappled with the civil rights movement. At protest marches, he was repeatedly beaten and jailed.

The Sun, referring to his anti-war protests, once wrote "the electric chair is too good for him".

Gregory remained active on the comedy scene until recently, when he fell ill and cancelled a show on 9 August in San Jose, California, followed by an appearance on 15 August in Atlanta.

On social media, he wrote that he felt energised by the messages from his well-wishers, and said he was looking to get back on stage because he had much to say about the racial tension brought on by the gathering of white supremacist hate groups in Charlottesville, Virginia.

"We have so much work still to be done, the ugly reality on the news this weekend proves just that," he wrote.