NEW YORK - With “Johnny B. Goode,” a 1958 song that so defined rock ‘n’ roll that the US space program chose it to introduce the music to potential extraterrestrials, Chuck Berry created a now classic character - the scrappy guitarist who triumphs through pure skill.

“People passing by, they would stop and say / Oh my, that little country boy could play,” Berry sang.

But Berry had tinkered with the lyrics. He later explained that he had originally written, “that little colored boy could play” - but changed it so the song could appear on the radio. Berry, who died Saturday at age 90, helped create both rock ‘n’ roll and modern youth culture, becoming one of the first African American stars to win a wide white audience.

Yet Berry was also forced to navigate a delicate line in a country that was still largely under the institutionalized discrimination of Jim Crow laws.

His career suffered a major blow when he was imprisoned for allegedly sleeping with an underage waitress - a conviction seen by many as a warning from the white establishment against African American artists who rise too far. As for the music, Berry achieved his success in part by his skill in understanding the racial divide. Born to a middle-class family in St. Louis, Berry played blues guitar but knew that white audiences wanted country. He combined the two - joking he was a “black hillbilly” - as well as other genres, creating the sensation that became rock ‘n’ roll, even if he hesitated to call himself its father.

As the baby boom generation came of age, Berry won cheering crowds with his consummate showmanship, including his “duck walk” across stage, and lyrics that celebrated youthful freedom. His first song “Maybellene” spoke of cruising in the open air in his Cadillac. Berry managed to capture “the rebelliousness, the playfulness, the irrepressibility” of a generation, said Jack Hamilton, an assistant professor at the University of Virginia and author of “Just Around Midnight: Rock and Roll and the Racial Imagination.”