According to the club's Twitter page, the Indian skipper put up a "good show" and the supporters were thrilled to have watched him from close quarters.
"The Madrid CC was originally formed back in 1975 by a group comprised of English and Indians. Soon thereafter other nationalities joined the club.
"Madrid CC was the only cricket club in Spain until 1982 when Barcelona CC was formed. In 1982 we saw the first game between the two sides. Madrid CC was disbanded in the early 1990's due to internal issues and some key members moving abroad," the club wrote said on its website.
The 35-year-old Dhoni, who has retired from Test cricket, will next be seen in action in January 2017 against England in ODIs and T20Is. He will also play for Jharkhand in the Vijay Hazare Trophy 50-over tournament in February.
Here are some of the pictures from Dhoni's visit to Madrid CC (All images from Madrid CC's Twitter page)
Crowd waits for "Captain Cool"
The crowd waited to see "mystery guest" at Madrid CC's home ground on Sunday (November 6). They were all thrilled when Dhoni walked in.
Madrid CC president Jon Woodward gets a signed bat from Dhoni
Dhoni prepares himself to play cricket at Madrid CC's ground
Dhoni shows his defensive skills. The fans might have not liked this but soon big shots arrived
Dhoni prepares to play a big shot. This is what his supporters came to see
One more big one
The fans got to watch big hits from Dhoni's bat. At the end of the day, it was a memorable Sunday for the people at the ground