TLS works by encrypting the data transmitted between two endpoints. This involves a series of steps including handshake protocol, where the client and server agree on encryption methods and exchange keys, followed by the actual data transmission using the agreed-upon encryption. This ensures that any intercepted data cannot be read or tampered with by unauthorized parties.