The 27-year-old defender had looked set for a move to Upton Park, after Mallorca revealed that a deal had been agreed last weekend. But the player has now passed his medical after being persuaded to move to the DW Stadium, and should complete his switch in the next 24 hours.
Chairman Dave Whelan said: "He has passed a medical and it is being concluded."
Whelan said the move was down to the influence of manager Roberto Martinez.
"The player doesn't speak English and didn't want to go to West Ham who had already agreed a deal.
"But Roberto asked me to go out to Mallorca where I met their chairman and with the club in receivership, they accepted my offer and then I went to see the player."
Although they are set to miss out on Ramis, West Ham have strengthened their defensive resources with the signing of Wales international James Collins from Aston Villa.