The charismatic Hugo Chazez had led the South American country since 1998. He died on Tuesday at the age of 58 after a long battle with cancer.
In a telegram sent to Venezuela's executive vice president Nicolás Maduro on Wednesday, the Spanish prime minster sent his condolences to Chavez's family.
In the telegram, Rajoy said Chavez was "one of the most influential figures in contemporary Venezuelan history".
The Spanish leader also said Spain would continue to work to strengthen bilateral ties with Venezuela and spoke of the strong friendship between the two countries and their citizens.
Earlier on Wednesday, the socialist politician and ex-prime minister of Spain, José Luis Rodriguez Zapatero, told Cadena Ser that Chavez's "heritage can't be viewed through European eyes".
He told the radio station that Chavez was part of a South American landscape and that it was too early to say what the legacy of Chavez would be.
The socialist politician went on to describe Chavez's personality as "passionate" both "in public and in private".
The King of Spain King Juan Carlos once famously said to Chavez "Why don't you just shut up?" during the 2007 Ibero-American Summit in Santiago, Chile. The Spanish king made the comment after Chavez repeatedly interrupted a speech by the then prime minister Zapatero.
Chavez stayed in power for 14 years, winning elections "with a mix of personal charisma, largesse in the use of oil money, populist rhetoric and an ability to convince many that their lives would be better thanks to the Bolivarian revolution," said Spanish daily El Pais.
Chavez's Bolivarian revolution, a socialist movement inspired by Venezuelan revolutionary leader Simon Bolivar, had promised economic independence and equality to the people.
"But it seems more than improbable that any successor will be able to stir enough support to make citizens tolerate for much longer the enormous financial imbalances, daily shortages, extensive corruption or rampant urban violence that afflict the Caribbean nation and that remain in place or are even worse after the late president's long reign," El Pais said.
A rival Spanish daily, the conservative El Mundo, said Chavez's death had sown "paranoia" among Venezuelan leaders. Vice President Nicolas Maduro made clear he believed there had been a "political assassination", it said.
"Now begins an uncertain interim period," El Mundo warned.
Chavez survived a military coup against him in 2002 and won 55 percent of the vote in Venezuela's most recent elections on October 7th 2012. He was, however, too ill to attend his inauguration.
The governments of Iran, China, Russia and Cuba have lauded the leadership of Chavez while US president Barack Obama released a statement saying: "The United States reaffirms its support for the Venezuelan people and its interest in developing a constructive relationship with the Venezuelan government."