Having a total hip replacement increases the risk of a stroke in the year after the operation, according to records of patients in Denmark.
Data from more than 66,000 operations showed the odds of a stroke increased more than fourfold in the fortnight immediately after surgery.
The research in the journal Stroke showed that taking drugs such as aspirin could reduce the risk.
The Stroke Association said the results should be taken “very seriously”.
Hip replacements are a very common operation, carried out on hundreds of thousands of people around the world each year.
Researchers in the UK and the Netherlands said the probability of having a stroke in the year after surgery was 2%, compared with 0.4% if they did not have the operation.
The risk peaked in the weeks after surgery before returning to normal over the course of a year.
One of the researchers, Prof Cyrus Cooper from the University of Southampton, said the risk was twice as high as would be expected from general surgery.
Taking medication which reduced the risk of a blood clot, such as aspirin, appeared to lower the risk in the study. The report’s authors called for more studies to investigate if patients should be given pills before going under the knife.
Prof Cooper said: “This research has demonstrated that there is a high risk of stroke to patients soon after having a total hip replacement and suggests that the use of soluble aspirin might be beneficial in reducing this risk.
“Normally we would have reservations about people taking aspirin every day but our results suggest aspirin is a benefit and worthwhile to give to the patient before the surgery.
“The data is of huge clinical importance.”
Dr Peter Coleman, from the Stroke Association charity, said: “Hip replacement surgery is a significant operation and can be very traumatic for the body. Like with any major surgery there is always a risk of incurring further health problems.
“This research suggests that hip replacement surgery could increase your risk of stroke and the results should be taken very seriously.
“If you are due to undergo a hip operation, it is important that you speak to your GP or hospital consultant beforehand in order to discuss the potential risks.”
By James Gallagher, Health and science reporter, BBC News