Port Otago had been in discussions with Maersk for the past 18 months about the ship's noise.
Monte Rosa would now be replaced by SFL Maui, which is silenced.
It was a "very pleasing" result for the port and wider community, Port Otago chief executive Kevin Winders said.
"Hopefully there will be a few less sleepless nights in Port Chalmers now, which I'm sure will be greatly appreciated," Winders said.
He hoped Monte Rosa would not return until it had a generator fitted.
West Harbour Community Board chairwoman Francisca Griffin said the community had been wanting the outcome for many years and it was a fantastic result.
"We're very pleased that Port Otago and Maersk have listened to us and come up with this outcome.
"It is just magic."
The Southern Star route starts in Malaysia, stopping in Brisbane and Sydney before heading to New Zealand for four port calls and heading back to Malaysia.
Port Chalmers is the last port call on the route.
Monte Rosa is scheduled to leave Port Otago at 10.15pm today.
Maersk did not respond to a request for comment.