Rap legend Tupac Shakur and grunge rockers Pearl Jam earned spots Tuesday in the Rock and Roll Hall of Fame as perpetual nominee Nile Rodgers finally won recognition — in a side category.

Tupac, who was slain in 1996, and Pearl Jam were both chosen to enter the shrine to rock culture in their first year of eligibility.

The other selected artists were folk singer Joan Baez, stadium-packing rockers Journey and two top forces in English progressive rock — Yes and the Electric Light Orchestra.

The Rock and Roll Hall of Fame will induct its new class at an April 7 concert at the Barclays Center in New York.

The Cleveland-based institution made its decision by nominating 19 acts and polling 800 music industry experts, with fan voting accounting for a single ballot.

Tupac remains one of the most iconic figures in rap even 20 years after his death, with fans worldwide drawn by his emotional directness and theatrical flair.

He will be inducted one year after the Hall of Fame chose politically charged gangsta rappers N.W.A., part of a growing recognition that hip-hop belongs to the rock tradition.