The sensor is "10 million times more effective" than traditional tests on patient blood samples, researchers said.
It has antibodies that can capture cancerous cells when they come into contact with an affected blood sample, and as a result weigh more.
The process causes the cancerous cells to change colour, indicating the presence of a malignant tumour, Priscila Kosaka from the Microelectronic Institute of Madrid (Spain) said.
The sensor, not expected to be on the market for another 10 years, may miss only 2 out of 10,000 samples, and can also be used to detect the onset of hepatitis and Alzheimer's, state run 'Xinhua' news agency reported.
Improvements are needed so that the nanosensor can identify the type of cancerous cells present in a sample, such as gastrointestinal or pancreatic.