Spin models are the prime example of simplified many-body Hamiltonians used to model complex, strongly correlated real-world materials. However, despite the simplified character of such models, their dynamics often cannot be simulated exactly on classical computers when the number of particles exceeds a few tens. For this reason, quantum simulation of spin Hamiltonians using the tools of atomic and molecular physics has become a very active field over the past years, using ultracold atoms or molecules in optical lattices, or trapped ions. All of these approaches have their own strengths and limitations. Here we report an alternative platform for the study of spin systems, using individual atoms trapped in tunable two-dimensional arrays of optical microtraps with arbitrary geometries, where filling fractions range from 60 to 100 per cent. When excited to high-energy Rydberg D states, the atoms undergo strong interactions whose anisotropic character opens the way to simulating exotic matter. We illustrate the versatility of our system by studying the dynamics of a quantum Ising-like spin-1/2 system in a transverse field with up to 30 spins, for a variety of geometries in one and two dimensions, and for a wide range of interaction strengths. For geometries where the anisotropy is expected to have small effects on the dynamics, we find excellent agreement with ab initio simulations of the spin-1/2 system, while for strongly anisotropic situations the multilevel structure of the D states has a measurable influence. Our findings establish arrays of single Rydberg atoms as a versatile platform for the study of quantum magnetism.