Walt Disney Co. and Scarlett Johansson have resolved their legal battle over her salary in the movie “Black Widow,” the two sides said Thursday.

The accord between Ms. Johansson and Disney brings to an end a two-month fight between the media giant and one of Hollywood’s biggest stars. Ms. Johansson sued Disney alleging her contract to star in the Marvel superhero movie “Black Widow” was breached when Disney decided to release the film on its Disney+ streaming service at the same time as its theatrical debut.