LOS ANGELES — Arizona starting pitcher Ian Kennedy hit Los Angeles starter Zack Greinke with a pitch in the seventh inning Tuesday night, a retaliation throw that caused a prolonged bench-clearing brawl that resulted in the ejection of five players and coaches.

An inning earlier, Greinke hit Diamondbacks catcher Miguel Montero and both teams came charging onto the field but it broke up quickly with no punches were thrown. That was payback for Kennedy hitting Dodgers rookie Yasiel Puig. The ball deflected off his shoulder and struck Puig on the nose.

Kennedy then hit Greinke in the upper left shoulder with one out in the seventh and the game tied 2-2. Both benches and bullpens cleared and a fight ensued near the Diamondbacks' dugout that nearly spilled into the stands.

Kennedy, manager Kirk Gibson and coach Turner Ward were ejected for Arizona. Puig and Dodgers hitting coach Mark McGwire were also tossed.

Things got out of hand after Kennedy hit Greinke. The teams went at it, with Dodgers reliever Ronald Belisario throwing punches and Puig rushing into the melee. Ward got slammed against a railing and was put in a headlock by Dodgers left fielder Skip Schumaker, who appeared to be trying to break up the fight as both teams kept pushing closer to the stands.

McGwire had Gibson's jersey and windbreaker with both hands and was screaming at him.

Dodgers manager Don Mattingly had to be restrained as he tried to get at Gibson, then they exchanged words briefly. McGwire and third base coach Matt Williams shouted at each other.

Montero, still in full catching gear, ended up on the ground next to Ward.