The Zurich-based side, who have won a record 27 league titles, had not lifted a trophy since they won the Swiss league 10 years ago.
The final was marred by vandalism as both sets of fans assembled in the historic centre of Berne before the game at the Stade de Suisse.
Police said in a statement that rival supporters, many of them masked, threw fireworks and stones at each other and six people suffered minor injuries.
"The forces had to use rubber bullets, pepper spray and tear gas to keep the groups separate and to calm the situation. Due to the high police presence further rioting was prevented," said the statement.
Television pictures also showed fans letting off firecrackers as they marched to the stadium with a huge police escort.
Markus Steinhoefer fired Basel ahead with a deflected shot off Stephane Grichting in the 70th minute, completely against the run of play.
Basel, who won the League and Cup double in two of the last three seasons, looked set to continue their domination until Izet Hajrovic levelled five minutes later, snapping up a rebound after Michael Lang's shot was parried by Yann Sommer.
Fabian Frei and Raul Bobadilla both hit the post for Basel as Grasshoppers won the penalty shootout 4-3 to win the cup for a record 19th time and the first since 1994. (Writing Brian Homewood in Berne; Editing by Toby Davis)