When did Cuba become communist?

With the defeat of dictatorship of Fulgencio Batista, Law professor José Miró Cardona created a new government with himself as prime minister and Manuel Urrutia Lleó as president on January 5, 1959. The United States officially recognized the new government two days later. Castro himself arrived in Havana to cheering crowds and assumed the post of Commander-in-Chief of the Armed Forces on January 8.

Miró resigned and on February 16, 1959, and Castro was sworn in as Prime Minister of Cuba.

Actually....

In 1959 Castro openly declared himself to be against communism stating, "I don't agree with communism. We are democracy. We are against all kinds of dictators... That is why we oppose communism." However, Castro did not declare Cuba a socialist country until May 1961 and himself a Marxist-Leninist until December 1961