Low-cost air pollution wireless sensors are emerging in densely distributed networks that provide more spatial resolution than typical traditional systems for monitoring ambient air quality. This paper presents an air quality measurement system that is composed of a distributed sensor network connected to a cloud system forming a wireless sensor network (WSN). Sensor nodes are based on low-power ZigBee motes, and transmit field measurement data to the cloud through a gateway. An optimized cloud computing system has been implemented to store, monitor, process, and visualize the data received from the sensor network. Data processing and analysis is performed in the cloud by applying artificial intelligence techniques to optimize the detection of compounds and contaminants. This proposed system is a low-cost, low-size, and low-power consumption method that can greatly enhance the efficiency of air quality measurements, since a great number of nodes could be deployed and provide relevant information for air quality distribution in different areas. Finally, a laboratory case study demonstrates the applicability of the proposed system for the detection of some common volatile organic compounds, including: benzene, toluene, ethylbenzene, and xylene. Principal component analysis, a multilayer perceptron with backpropagation learning algorithm, and support vector machine have been applied for data processing. The results obtained suggest good performance in discriminating and quantifying the concentration of the volatile organic compounds.