The two teams had battled through nine scoreless innings before the Marlins finally broke through for a run in the 10th.
Royals hurler Kelvin Herrera (4-6) hit Jake Marisnick with a pitch to begin the inning, and the Miami center fielder stole second as Jeff Mathis struck out looking.
That brought up Yelich, who grounded a single through the right side of the infield for the go-ahead tally.
Chad Qualls (3-1) was credited with the victory after recording the final two outs of the ninth and Steve Cishek notched his 25th save as Miami rebounded from a 6-2 loss in Monday's three-game series opener.
Marlins starter Jose Fernandez scattered three hits over seven scoreless innings, walking one and striking out six.
Kansas City counterpart Bruce Chen matched him, also yielding three hits over seven shutout innings with three walks and six strikeouts.
2014: The Year in Music [PHOTOS]