Interpretation of spatial features often requires combined reasoning over geometry and semantics. We introduce the Space package, an open source SWI-Prolog extension that provides spatial indexing capabilities. Together with the existing semantic web reasoning capabilities of SWI-Prolog, this allows efficient integration of spatial and semantic queries and provides an infrastructure for declarative programming with space and semantics. There are few systems that provide indexing and reasoning facilities for both spatial and semantic data. A common solution is to combine separate semantic reasoning and geospatial services. Such loose coupling has the disadvantage that each service cannot make use of the statistics of the other. This makes optimization of such a service-oriented architecture hard. The SWI-Prolog Space and Semantic web packages provide a native Prolog interface to both spatial and semantic indexing and reasoning, which makes it easy to write combined query optimizers. Another advantage of the Space package is that it allows declarative logic programming, which means in practice that you say what you want to compute instead of how to compute it. The actual indexing machinery is encapsulated inside Prolog predicates. In this article we describe the interface of the Space package, compare its functionality to alternative software libraries, and show how to work with it using three example applications. These example illustrations include reasoning over movement patterns, dynamically loading geospatial linked data off the semantic web, and setting up a simple KML server. © 2010 Blackwell Publishing Ltd.