"An argument ensued", the sheriff said in a statement. Sheriffs then tased the suspect and opened fire when that did not stop him.
Elizarraras was transported to Scripps Memorial Hospital La Jolla in stable condition and is expected to survive his injuries.
The track was hosting a post-race concert featuring Ice Cube, the popular rap artist, writer and actor whose former group NWA, was the subject in the movie, "Straight Outta Compton".
Within minutes there was a heavy police presence as San Diego County deputies streamed into the track and a helicopter was seen overhead.
When sheriff's deputies responded to the confrontation, Elizarraras pulled out "a silver-plated semi-automatic handgun" and fired "several shots" into a crowd just outside the Del Mar Fairgrounds.
Sheriff's officials confirmed there was an officer-involved shooting but would not immediately provide details.
Twitter videos were shared showing TVG's on-air coverage of a race at the track and an announcer could be heard shouting "there is gun fire at the track".
Shots have been fired at Del Mar racecourse, with gunfire heard as horses were crossing the finish line in the final race of the day.
Ice Cube, who once rapped "shotgun bullets is bad for yo' health", was due to perform at San Diego's Del Mar Racecourse on Sunday.
The exchange of gunfire occurred just before Ice Cube was set to take the stage as part of Del Mar's Summer Concert Series, his performance set to be the last show of the summer schedule.
About 7:30 p.m. Pacific time, the operators of the racetrack tweeted that "the situation has been contained", and the concert would be "moving forward as planned".