Milan dominated the first half and created numerous chances to break the deadlock.
They continued to control proceedings after the restart, but once again found keeping their efforts on target difficult.
Their failure to do so was punished against the run of play with 58 minutes played. Fernando Tissone swung over a corner which was met by Costa, who sent the ball into the home net from close range.
Milan laid siege on the away goal in the closing stages, but goalkeeper Sergio Romero and his defence held firm to claim the victory.