This paper presents a model for quality-of-service (QoS)-aware service composition in distributed systems with real-time and fault-tolerance requirements. This model can be applied in application domains like, for example, remote monitoring, control and surveillance. Classic approaches to real-time systems do not provide the flexibility and fault-tolerance required in new emerging environments that need to combine a high degree of dynamism with temporal predictability. Our approach addresses these new challenges by combining concepts from the service oriented paradigm and distributed real-time systems. We propose a concrete system model based on a holistic time-triggered-based approach for design and configuration. Based on this model, we propose two algorithms for the composition of QoS-aware service-based applications with temporal requirements: an exhaustive algorithm that computes the optimal service combination in terms of a figure of merit, suitable for offline composition; and an improved algorithm based on heuristics and partial figures of merit, suitable for online composition. Experimental results show that the latter reduces dramatically the number of combinations explored with a minimal degradation in the quality of the solution, making it feasible for online execution in dynamic environments.