The Boston Bruins have signed restricted free agent David Pastrnak to a six-year, $40 million contract.

The contract carries an annual cap hit of $6.67 million, making him the fourth-highest paid Bruin, behind David Krejci ($7.25 million), Tuukka Rask ($7 million) and Patrice Bergeron ($6.875 million). 

In 75 games last season, the 21-year-old Pastrnak exploded for 34 goals and 36 assists. He trailed only Brad Marchand, who owns a $6.125 million cap hit, for the team-lead in points. He added two goals and two assists in six playoff games, while averaging over 21 minutes of ice time per contest.

Marchand and Pastrnak are the only Bruins signed through the 2022-23 season.

Pastrnak was taken at No. 25 overall in the first round of the 2014 NHL entry draft by the Bruins, making his debut later that season. He was one of two players from the 2014 draft to play in 40 or more games in the same season, appearing in a total of 46 games. The other was No. 1 overall pick Aaron Ekblad.

A native of Havirov in the Czech Republic, Pastrnak is coming off a three-year, $2.775 million entry-level deal. His new deal leaves the Bruins with just under $3.5 million in cap space for this season, according to CapFriendly. 

He has 59 goals and 64 assists in 172 career regular season games. He ranked tied for 10th in goals and tied for 18th in points in the NHL last season.

The Bruins open training camp on Thursday, though Pastrnak, as of Wednesday, is believed to be in the Czech Republic.