Lehigh Valley rallied to defeat the Scranton/Wilkes-Barre RailRiders, 8-5, in 10 innings Wednesday at PNC Field.

A four-run 10th was the difference after the IronPigs rallied from a two-run, ninth-inning deficit.

Keaton Anthony homered off RailRiders’ reliever Dylan Coleman, Christian Cairo had a sacrifice fly and Dylan Moore’s RBI single accounted for the IronPigs runs in the 10th.

In the home half of the frame, Oswaldo Cabrera singled to lead off, and a Ernesto Martinez Jr. base hit scored Yanquiel Fernández to climb within three. But Lehigh Valley reliever Kirby Snead retired the final two batters to close the game.

Trailing by two runs in the ninth, Lehigh Valley’s Felix Reyes blasted a three-run home run off reliever Coleman for a 4-3 lead.

SWB answered in the bottom of the ninth. Yankees No. 1 prospect George Lombard Jr. doubled with two outs, and Kenedy Corona singled to level the game at four. Corona stole second and advanced to third on a throwing error, but was left stranded, sending the game to extras.

Martinez Jr. and Duke Ellis homered in the fourth as the RailRiders built a three-run advantage.

The IronPigs put their first run on the board in the sixth when Otto Kemp scored on a Gabriel Rincones Jr. groundout, cutting the deficit to two.

Angel Chivilli started for the RailRiders in a Yankees rehab appearance, pitching 1.1 scoreless frames, allowing two hits and striking out two.