The Spaniard got the better of the Serbian 6-3 6-7(5) 2-6 6-3 7-6(4) at Flushing Meadows on Thursday.
"I'm really happy," said Ferrer. "It was a very emotional match. It was a really tough match.
"Janko, he's an amazing player and he really fought a lot. He deserved to win today too.
"It was a lottery in the fifth set. I had a break down but I was fighting also and I won. I had to fight a lot and be focused every point."
Ferrer will now take on either Juan Martin del Potro or Novak Djokovic for a place in the final.