This thesis reports on the development of different control tools for Brain-machine interface-based assistance and rehabilitation. Brain activity is analyzed with the purpose of classify mental tasks and detecting movement intentions in patients with impaired motility. Event-Related Desynchronization (ERD) and Event-Related Synchronization (ERS) are detected. Throughout this book, different control systems are presented and validated. This thesis, examined at the Miguel Hernández University of Elche, Spain, in 2016, received the award for the best thesis in bioengineering from the Bioengineering group of the Spanish Committee of Automatic Control (CEA) in 2017.