CLEVELAND -- LeBron James has signed a two-year contract with the Cleveland Cavaliers, a team he brought back from despair to the NBA Finals in one season.

James agreed to the $47 million deal, which includes a player option for the 2016-17 season, on Thursday and finalized the agreement on Friday shortly before hosting a private screening for the new movie "Trainwreck," in which he has a supporting role.

The deal follows James' plan to keep year-to-year flexibility to take advantage of expected increases in the salary cap.

James, who has been on vacation the past week, didn't talk to any other teams and always intended to re-sign with the Cavs. James met with Kevin Love before free agency started, and they discussed plans for the upcoming season. Love signed a five-year, $113 million deal to stay with the Cavaliers.

The signing comes a day before the one-year anniversary of his return to Cleveland after spending four seasons in Miami.

The 30-year-old has indicated he will play the remainder of his career with the Cavs, who went from a lottery team to Eastern Conference champions in James' first season back.

Cavs general manager David Griffin said James' re-signing is "a reflection and continuation of his strong, personal commitment to help deliver championships to northeast Ohio and Cavs fans everywhere."

The Cavs announced Thursday that they also had re-signed guard Iman Shumpert, who said last week that he intended to re-sign with the team. Sources told ESPN.com that deal was for four years and $40 million.

It had been expected that James would wait to see whether forward Tristan Thompson, who is also represented by agent Rich Paul, would sign before he negotiated with the Cavs. But on the first day teams could sign players, James made his intentions known to the Cavs.

With more experienced players and perhaps a few new ones, there's no reason the Cavs won't be in the title chase again. James' skills have shown no signs of erosion, and owner Dan Gilbert has shown a willingness to shell out major money to keep his biggest star surrounded with quality players.

And while his agreement with the Cavs is not a surprise, it does give him future flexibility and the ability to make more money next summer, when the league's new TV deal kicks in. The salary cap is expected to escalate by millions with the start of the $24 billion package.

James led the Cavs to the Finals in his first season back. Cleveland lost in six games to Golden State despite his stellar efforts.

Forced to carry the scoring load after injuries to All-Star point guard Kyrie Irving and Love, James was brilliant against the Warriors, averaging 35.8 points, 13.3 rebounds and 8.8 assists per game -- the best statistical line in Finals history.

James said he is more motivated than ever to bring a championship to Cleveland, which has not had a major pro sports team win a title since 1964.

Information from ESPN's Chris Broussard and Brian Windhorst and The Associated Press was used in this report.