The pair went at each other from the first bell and the action was furious in bursts.
Ramirez shaded the opening round 6-5, but began to move up the gears at the start of the second round.
However, the Mongolian came on strongly as the round wore on, rocking the Cuban's head back with a few stiff shots.
Nyambayar still trailed by just one point and continued to ask some tough questions of Ramirez, who responded well to land more shots and inch towards victory.
The judges awarded the Cuban a 17-14 decision.